diff --git a/src/g1-info.js b/src/g1-info.js index 7ce8d20..a653799 100644 --- a/src/g1-info.js +++ b/src/g1-info.js @@ -12,7 +12,7 @@ bot.global.text({ if (err) { b.respond("Une erreur est survenu ...") } else { - b.respond(stdout) + if (stdout) { b.respond(stdout); } } }); }, { @@ -28,7 +28,7 @@ bot.global.text({ if (err) { b.respond("Une erreur est survenu ...") } else { - b.respond(stdout) + if (stdout) { b.respond(stdout); } } }); }, { @@ -44,7 +44,7 @@ bot.global.text({ if (err) { b.respond("Une erreur est survenu :" + stderr) } else { - b.respond(stdout) + if (stdout) { b.respond(stdout); } } }); }, { @@ -58,7 +58,7 @@ bot.global.text({ if (err) { b.respond("Une erreur est survenu ...") } else { - b.respond(stdout) + if (stdout) { b.respond(stdout); } } }); }, { @@ -66,7 +66,7 @@ bot.global.text({ }); bot.global.text({ - starts: ['deb','biz deb'] + starts: ['debug delay','biz debug delay'] }, (b) => { username = b.message.user.name cmd = b.message.text diff --git a/src/gbanque.js b/src/gbanque.js index b1622f9..1e772ec 100644 --- a/src/gbanque.js +++ b/src/gbanque.js @@ -9,13 +9,11 @@ bot.global.text({ tool="axiomchat" room = b.message.user.room.name process.env.hb_cmd = b.message.text + process.env.hb_username = b.message.user.name + "@" + tool if (typeof room === 'undefined' || room === null) { - process.env.hb_username = b.message.user.name + "@" + tool process.env.hb_room = room } else { - process.env.hb_username = b.message.user.name + "@" + tool -// process.env.hb_username = b.message.user.name process.env.hb_room = room + "@" + tool } @@ -23,7 +21,7 @@ bot.global.text({ if (err) { b.respond("Une erreur est survenu: " + stderr) } else { - b.respond(stdout) + if (stdout) { b.respond(stdout); } } }); diff --git a/src/shell/aide.sh b/src/shell/aide.sh index 5136ce3..2802d4b 100755 --- a/src/shell/aide.sh +++ b/src/shell/aide.sh @@ -1,5 +1,8 @@ #!/bin/bash +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + auto() { echo "*Je suis l'aide auto*" cd src @@ -13,9 +16,11 @@ auto() { } text() { - cat src/inc/aide.txt + cat $MY_PATH/../inc/aide.txt } -[[ $(type $@ | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande" +#argcmd=$(echo "$@" | tr ' ' '\n' | grep -vE 'bog|bog|biz|aide|help' | tr '\n' ' ') +#[[ $(type $argcmd) =~ "est une fonction" ]] && $argcmd || echo "Veuillez préciser votre commande" +text -exit 0 +#exit 0 diff --git a/src/shell/functions.sh b/src/shell/functions.sh index e4950a2..3f257f8 100755 --- a/src/shell/functions.sh +++ b/src/shell/functions.sh @@ -71,7 +71,7 @@ getPubkey() { getPseudo() { url="$node/wot/members" - args=$(echo $@ | tr ' ' '\n' | grep -vEw 'biz|G1LibreBot' | tr '\n' ' ') + args=$(echo $@ | tr ' ' '\n' | grep -vEw 'biz|bog' | tr '\n' ' ') [ $(echo $args | wc -w) -ge 2 ] && pubkey=$(echo $args | awk '{ print $2 }') || pubkey=$1 # pubkey="$1" pubkey=$(echo $pubkey | tr -d '@') diff --git a/src/shell/g1-infos.sh b/src/shell/g1-infos.sh index a222966..6a30c3d 100755 --- a/src/shell/g1-infos.sh +++ b/src/shell/g1-infos.sh @@ -9,9 +9,10 @@ source $MY_PATH/functions.sh # Get Ḡ1 pubkey base on pseudo pubkey() { - local args=$(echo $@ | tr ' ' '\n' | grep -vEw 'biz|G1LibreBot' | tr '\n' ' ') + local args=$(echo $@ | tr ' ' '\n' | grep -vEw 'biz|bog' | tr '\n' ' ') [ $(echo $args | wc -w) -ge 3 ] && local usernameK=$(echo $args | awk '{ print $3 }') || local usernameK=$1 # local usernameK=$(echo $usernameK | tr -d '@') + [[ -z $usernameK ]] && echo "Veuillez indiquez un username de compte Ḡ1." && exit 0 [[ ${usernameK::1} == '@' ]] && usernameK=${usernameK#?} local pubkey=$(getPubkey $args) [[ ${usernameK::1} != '#' ]] && usernameK="@$usernameK" @@ -22,11 +23,13 @@ pubkey() { pseudo() { getPseudo $@; } silkaj() { - local args=$(echo "$@" | tr ' ' '\n' | grep -vEw 'silkaj|biz|G1LibreBot' | tr '\n' ' ') + local args=$(echo "$@" | tr ' ' '\n' | grep -vEw 'silkaj|biz|bog' | tr '\n' ' ') local cmd=$(echo $args | tr ' ' '\n' | grep -v '-' | head -n1) [[ $cmd =~ ^(tx|authfile|cert)$ ]] && echo "BoḠ refuse d'executer la commande \`$cmd\` ... :eyes:" && exit 0 local result=$($silkaj $args) || echo "Silkaj ne comprends cette commande." - echo "\`\`\`$result\`\`\`" + echo "\`\`\` +$result +\`\`\`" } membres() { @@ -42,6 +45,6 @@ deb() { echo -e "coucou $usernameK\ncmd: *$cmd*" } -[[ $(type $@ | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande" +[[ $(type $1 | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande" exit 0 diff --git a/src/shell/gbanque.sh b/src/shell/gbanque.sh index 792c37d..38a37fe 100755 --- a/src/shell/gbanque.sh +++ b/src/shell/gbanque.sh @@ -5,7 +5,7 @@ MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized source $MY_PATH/functions.sh -args=$(echo "$@" | awk -F '~~~' '{ print $1 }' | tr ' ' '\n' | grep -vEwi 'gbanque|gb|biz|G1LibreBot' | tr '\n' ' ') +args=$(echo "$@" | awk -F '~~~' '{ print $1 }' | tr ' ' '\n' | grep -vEwi 'gbanque|gb|biz|bog' | tr '\n' ' ') cmd=$(echo "$args" | awk '{ print $1 }') args=$(echo "$args" | awk '{$1=""; print $0}') user=$(echo "$@" | awk -F '~~~' '{ print $2 }')