This repository has been archived on 2023-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
bog-bbot-archive/src/shell/gbanque.sh

36 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
source $MY_PATH/functions.sh
args=$(echo "$@" | awk -F '~~~' '{ print $2 }' | tr ' ' '\n' | grep -vEwi 'gbanque|gb|biz' | tr '\n' ' ')
cmd=$(echo "$args" | awk '{ print $1 }')
args=$(echo "$args" | awk '{$1=""; print $0}')
user=$(echo "$@" | awk -F '~~~' '{ print $3 }')
room=$(echo "$@" | awk -F '~~~' '{ print $4 }')
[[ $room == "undefined" ]] && dest="@$user" || dest="#$room"
init() {
## Récupération depuis Ḡ1SMS
## ./shell/sms_NEW.sh "$PHONE" "$MEMBERUID" &
## ./silkaj/silkaj generate_auth_file --auth-scrypt -salt="$PHONE" -password="$PIN"
# echo "Cette conversation continue en privé @$user - @biz"
## TODO: Définir le workflow g1sms
init_account $dest
}
remove() { rm_account $dest; }
info() { info_account $dest; }
pay() { tx $dest $args; }
history() { history_account $dest; }
[[ "$cmd" =~ ^(init|remove|info|pay|history)$ ]] && "$cmd" || echo "Veuillez indiquer une commande valide"
exit 0