Transaction beetwin 2 tools OK
This commit is contained in:
parent
b4c023fa80
commit
d525ca046a
|
@ -8,7 +8,7 @@ bot.global.text({
|
||||||
cmd = b.message.text
|
cmd = b.message.text
|
||||||
process.env.hb_cmd = cmd
|
process.env.hb_cmd = cmd
|
||||||
process.env.hb_username = username
|
process.env.hb_username = username
|
||||||
pubkey = exec("src/shell/g1-infos.sh pubkey $hb_username $hb_cmd", function(err, stdout, stderr) {
|
exec("src/shell/g1-infos.sh pubkey $hb_username $hb_cmd", function(err, stdout, stderr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
b.respond("Une erreur est survenu ...")
|
b.respond("Une erreur est survenu ...")
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,7 +24,7 @@ bot.global.text({
|
||||||
}, (b) => {
|
}, (b) => {
|
||||||
cmd = b.message.text
|
cmd = b.message.text
|
||||||
process.env.hb_cmd = cmd
|
process.env.hb_cmd = cmd
|
||||||
pubkey = exec("src/shell/g1-infos.sh pseudo $hb_cmd", function(err, stdout, stderr) {
|
exec("src/shell/g1-infos.sh pseudo $hb_cmd", function(err, stdout, stderr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
b.respond("Une erreur est survenu ...")
|
b.respond("Une erreur est survenu ...")
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,7 +40,7 @@ bot.global.text({
|
||||||
}, (b) => {
|
}, (b) => {
|
||||||
cmd = b.message.text
|
cmd = b.message.text
|
||||||
process.env.hb_cmd = cmd
|
process.env.hb_cmd = cmd
|
||||||
pubkey = exec("src/shell/g1-infos.sh silkaj $hb_cmd", function(err, stdout, stderr) {
|
exec("src/shell/g1-infos.sh silkaj $hb_cmd", function(err, stdout, stderr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
b.respond("Une erreur est survenu :" + stderr)
|
b.respond("Une erreur est survenu :" + stderr)
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,7 +54,7 @@ bot.global.text({
|
||||||
bot.global.text({
|
bot.global.text({
|
||||||
starts: ['membre','membres', 'biz membre','biz membres']
|
starts: ['membre','membres', 'biz membre','biz membres']
|
||||||
}, (b) => {
|
}, (b) => {
|
||||||
membres = exec("src/shell/g1-infos.sh membres", function(err, stdout, stderr) {
|
exec("src/shell/g1-infos.sh membres", function(err, stdout, stderr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
b.respond("Une erreur est survenu ...")
|
b.respond("Une erreur est survenu ...")
|
||||||
} else {
|
} else {
|
||||||
|
@ -64,3 +64,25 @@ bot.global.text({
|
||||||
}, {
|
}, {
|
||||||
id: 'g1-membres'
|
id: 'g1-membres'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
bot.global.text({
|
||||||
|
starts: ['deb','biz deb']
|
||||||
|
}, (b) => {
|
||||||
|
username = b.message.user.name
|
||||||
|
cmd = b.message.text
|
||||||
|
process.env.hb_cmd = cmd
|
||||||
|
process.env.hb_username = username
|
||||||
|
|
||||||
|
setTimeout(() => { b.respond("coucou " + cmd); }, 2000);
|
||||||
|
/* exec("src/shell/g1-infos.sh deb $hb_username $hb_cmd", function(err, stdout, stderr) {
|
||||||
|
if (err) {
|
||||||
|
b.respond("Une erreur est survenu ...")
|
||||||
|
} else {
|
||||||
|
b.respond(stdout)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
}, {
|
||||||
|
id: 'debug-multi'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ bot.global.text({
|
||||||
process.env.hb_username = b.message.user.name + "@" + tool
|
process.env.hb_username = b.message.user.name + "@" + tool
|
||||||
process.env.hb_room = room
|
process.env.hb_room = room
|
||||||
} else {
|
} else {
|
||||||
process.env.hb_username = b.message.user.name
|
process.env.hb_username = b.message.user.name + "@" + tool
|
||||||
|
// process.env.hb_username = b.message.user.name
|
||||||
process.env.hb_room = room + "@" + tool
|
process.env.hb_room = room + "@" + tool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash -e
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
[[ -n $MY_PATH/.env ]] && source $MY_PATH/.env || (echo "Please create $MY_PATH/.env as $MY_PATH/.env.example" && exit 1)
|
[[ -n $MY_PATH/.env ]] && source $MY_PATH/.env || (echo "Please create $MY_PATH/.env as $MY_PATH/.env.example" && exit 1)
|
||||||
|
|
||||||
# Globals variables
|
function DEBUG()
|
||||||
|
{
|
||||||
|
[ "$_DEBUG" == "on" ] && $@
|
||||||
|
}
|
||||||
|
|
||||||
chanDB() {
|
chanDB() {
|
||||||
if [[ "$1" =~ '@' ]]; then
|
if [[ "$1" =~ '@' ]]; then
|
||||||
chan=$(echo "$1" | awk -F '@' '{ print $1 }')
|
chan=$(echo "$1" | awk -F '@' '{ print $1 }')
|
||||||
|
@ -13,39 +17,56 @@ chanDB() {
|
||||||
else
|
else
|
||||||
chan="$1"
|
chan="$1"
|
||||||
fi
|
fi
|
||||||
[[ ! $chan ]] && echo "Please select user." && exit 0
|
[[ ! $chan ]] && echo "Please select user." && return 2
|
||||||
if [[ "$chan" =~ '#' ]]; then
|
if [[ "$chan" =~ '#' ]]; then
|
||||||
homedir="$HOME/.bog/ids/$tool/$chan"
|
homedir="$HOME/.bog/ids/$tool/$chan"
|
||||||
else
|
else
|
||||||
homedir="$HOME/.bog/ids/$tool/@$chan"
|
homedir="$HOME/.bog/ids/$tool/@$chan"
|
||||||
fi
|
fi
|
||||||
# echo "args: $1"
|
DEBUG echo "_${FUNCNAME[0]}_: $chan"
|
||||||
# echo "tool: $tool"
|
DEBUG echo "_${FUNCNAME[0]}_: $tool"
|
||||||
# echo "homedir: $homedir"
|
DEBUG echo "_${FUNCNAME[0]}_: $homedir"
|
||||||
[[ -f $homedir/db ]] && source $homedir/db
|
[[ -f $homedir/db ]] && source $homedir/db
|
||||||
}
|
}
|
||||||
|
|
||||||
# Send a message
|
# Send a message
|
||||||
sendmsg() {
|
sendmsg() {
|
||||||
chanDB "$1"
|
chanDB "$1"
|
||||||
[[ ! "$chan" == '#|@'* ]] && chan="@$chan"
|
[[ ! "${chan::1}" =~ ^(#|@)$ ]] && chan="@$chan"
|
||||||
local msg="${@:2}"
|
local msg="${@:2}"
|
||||||
|
|
||||||
[[ ! $chan || ! $msg ]] && echo "Please select user and message." && exit 0
|
[[ ! $chan || ! $msg ]] && echo "Please select user and message." && return 2
|
||||||
|
|
||||||
curl -s -H "X-Auth-Token: $AC_API_TOKEN" \
|
DEBUG echo "_${FUNCNAME[0]}_: $chan"
|
||||||
-H "X-User-Id: $AC_API_ID" \
|
DEBUG echo "_${FUNCNAME[0]}_: $tool"
|
||||||
-H "Content-type:application/json" \
|
|
||||||
$API_URL/api/v1/chat.postMessage \
|
if [[ $tool == "axiomchat" ]]; then
|
||||||
-d "{ \"channel\": \"$chan\", \"text\": \"$msg\" }" > /dev/null 2>&1
|
curl -s -H "X-Auth-Token: $AC_API_TOKEN" \
|
||||||
|
-H "X-User-Id: $AC_API_ID" \
|
||||||
|
-H "Content-type:application/json" \
|
||||||
|
$AC_API_URL/api/v1/chat.postMessage \
|
||||||
|
-d "{ \"channel\": \"$chan\", \"text\": \"$msg\" }" > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
echo -e "$msg"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
getPubkey() {
|
getPubkey() {
|
||||||
url="$node/wot/members"
|
url="$node/wot/members"
|
||||||
[[ -z $username || $username == "bot" ]] && username=$(echo $1 | tr -d '@')
|
# [[ -z $username || $username == "bot" ]] && username=$(echo $1 | tr -d '@')
|
||||||
# old way: local pubkey=$(curl -m 5 -s $url | grep -wiB 1 $username | grep "pubkey" | awk -F '"' '{ print $4 }')
|
# old way: local pubkey=$(curl -m 5 -s $url | grep -wiB 1 $username | grep "pubkey" | awk -F '"' '{ print $4 }')
|
||||||
local pubkey=$(curl -m 10 -s $url | jq -r --arg username "$username" '.results[] | select(.uid==$username) | .pubkey')
|
[[ ! $usernameK ]] && usernameK="$1"
|
||||||
|
[[ ${usernameK::1} == '@' ]] && usernameK=${usernameK#?}
|
||||||
|
|
||||||
|
if [[ "$usernameK" =~ '@' ]]; then
|
||||||
|
chanDB "$usernameK"
|
||||||
|
else
|
||||||
|
local pubkey=$(curl -m 10 -s $url | jq -r --arg username "$usernameK" '.results[] | select(.uid==$username) | .pubkey')
|
||||||
|
fi
|
||||||
|
# DEBUG echo "_${FUNCNAME[0]}_: $pubkey"
|
||||||
|
# DEBUG echo "_${FUNCNAME[0]}_: $usernameK"
|
||||||
[[ $pubkey ]] && echo "$pubkey" || echo "none"
|
[[ $pubkey ]] && echo "$pubkey" || echo "none"
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
getPseudo() {
|
getPseudo() {
|
||||||
|
@ -62,7 +83,7 @@ getPassword() {
|
||||||
chanDB "$1"
|
chanDB "$1"
|
||||||
if [[ -d $homedir ]]; then
|
if [[ -d $homedir ]]; then
|
||||||
sendmsg $chan "Voici les identifiants de connexion de votre ḠCompte: \n \
|
sendmsg $chan "Voici les identifiants de connexion de votre ḠCompte: \n \
|
||||||
Login: **$salt**\nMot de passe: **$pepper**\nClé publique: **$pubkey** \n \
|
Login: *$salt*\nMot de passe: *$pepper*\nClé publique: *$pubkey* \n \
|
||||||
Calcul du solde de votre compte en cours ..."
|
Calcul du solde de votre compte en cours ..."
|
||||||
else
|
else
|
||||||
echo "Vous n'avez pas de compte chez nous."
|
echo "Vous n'avez pas de compte chez nous."
|
||||||
|
@ -72,10 +93,10 @@ Calcul du solde de votre compte en cours ..."
|
||||||
info_account() {
|
info_account() {
|
||||||
chanDB "$1"
|
chanDB "$1"
|
||||||
if [[ -d $homedir ]]; then
|
if [[ -d $homedir ]]; then
|
||||||
sendmsg $chan "Récupération de votre solde en cours sur **$pubkey** ..."
|
sendmsg $chan "Récupération de votre solde en cours sur *$pubkey* ..."
|
||||||
|
|
||||||
local solde=$($silkaj balance $pubkey | grep "Total Quantitative" | awk -F= '{ print $2 }' | cut -c2-)
|
local solde=$($silkaj balance $pubkey | grep "Total Quantitative" | awk -F= '{ print $2 }' | cut -c2-)
|
||||||
echo "Votre solde est de **$solde**"
|
echo "Votre solde est de *$solde*"
|
||||||
else
|
else
|
||||||
echo "Vous n'avez pas de compte chez nous."
|
echo "Vous n'avez pas de compte chez nous."
|
||||||
fi
|
fi
|
||||||
|
@ -85,8 +106,8 @@ init_account() {
|
||||||
chanDB "$1"
|
chanDB "$1"
|
||||||
if [[ -f $homedir/secret.dunikey ]]; then
|
if [[ -f $homedir/secret.dunikey ]]; then
|
||||||
pubkey=$(cat $homedir/secret.dunikey| grep "pub: " | awk '{ print $2 }')
|
pubkey=$(cat $homedir/secret.dunikey| grep "pub: " | awk '{ print $2 }')
|
||||||
echo "Vous disposez déjà d'un portefeuille Ḡ1: **$pubkey**"
|
echo "Vous disposez déjà d'un portefeuille Ḡ1: *$pubkey*"
|
||||||
exit 0
|
return 2
|
||||||
else
|
else
|
||||||
sendmsg $dest "Création de votre portefeuille..."
|
sendmsg $dest "Création de votre portefeuille..."
|
||||||
fi
|
fi
|
||||||
|
@ -98,21 +119,23 @@ init_account() {
|
||||||
# The pubkey for this salt/papper peer
|
# The pubkey for this salt/papper peer
|
||||||
local pubkey=$(python3 $MY_PATH/../dunikey/key_create_dunikey.py "$salt" "$pepper")
|
local pubkey=$(python3 $MY_PATH/../dunikey/key_create_dunikey.py "$salt" "$pepper")
|
||||||
|
|
||||||
[[ ! -f /tmp/secret.dunikey ]] && echo "Arf, problem happens making your secret.dunikey" && exit 0
|
[[ ! -f /tmp/secret.dunikey ]] && echo "Arf, problem happens making your secret.dunikey" && return 2
|
||||||
[[ ! -d $homedir ]] && mkdir -p $homedir
|
[[ ! -d $homedir ]] && mkdir -p $homedir
|
||||||
[[ -f /tmp/secret.dunikey ]] && rm -f $homedir/secret.dunikey && mv /tmp/secret.dunikey $homedir/secret.dunikey
|
[[ -f /tmp/secret.dunikey ]] && rm -f $homedir/secret.dunikey && mv /tmp/secret.dunikey $homedir/secret.dunikey
|
||||||
|
|
||||||
echo -e "salt=\"$salt\"\npepper=\"$pepper\"\npubkey=\"$pubkey\"" > $homedir/db
|
echo -e "salt=\"$salt\"\npepper=\"$pepper\"\npubkey=\"$pubkey\"" > $homedir/db
|
||||||
|
|
||||||
# info_account $chan
|
# info_account $chan
|
||||||
echo -e "Votre ḠCompte a bien été créé.\nPubkey: **$pubkey**"
|
echo -e "Votre ḠCompte a bien été créé.\nPubkey: *$pubkey*"
|
||||||
}
|
}
|
||||||
|
|
||||||
rm_account() {
|
rm_account() {
|
||||||
chanDB "$1"
|
chanDB "$1"
|
||||||
if [[ -d $homedir ]]; then
|
if [[ -d $homedir ]]; then
|
||||||
|
local solde=$($silkaj balance $pubkey | grep "Total Quantitative" | awk -F= '{ print $2 }' | cut -c2- | awk '{ print $1 }')
|
||||||
|
[[ "$solde" != "0.0" ]] && echo "Votre solde n'est pas nulle: $solde Ḡ1. Veuillez vider votre compte avant de pouvoir le supprimer." && return 2
|
||||||
echo "Suppression des données de votre portefeuille de votre ḠBanque."
|
echo "Suppression des données de votre portefeuille de votre ḠBanque."
|
||||||
echo -e "Login: **$salt**\nMot de passe: **$pepper**\nClé publique: **$pubkey**"
|
echo -e "Login: *$salt*\nMot de passe: *$pepper*\nClé publique: *$pubkey*"
|
||||||
rm -r $homedir
|
rm -r $homedir
|
||||||
echo "Suppression terminé, nous ne disposons plus d'aucune donnée vous concernant."
|
echo "Suppression terminé, nous ne disposons plus d'aucune donnée vous concernant."
|
||||||
else
|
else
|
||||||
|
@ -121,27 +144,33 @@ rm_account() {
|
||||||
}
|
}
|
||||||
|
|
||||||
tx() {
|
tx() {
|
||||||
chanDB "$1"
|
|
||||||
local dest="$2"
|
local dest="$2"
|
||||||
|
local dest1="$dest"
|
||||||
local amount=$(echo "$3" | tr ',' '.')
|
local amount=$(echo "$3" | tr ',' '.')
|
||||||
local comment="${@:4}"
|
local comment="${@:4}"
|
||||||
|
|
||||||
! [[ $dest && $amount ]] && echo "Des arguments sont manquants. Ex: pay Do99s6wQR2JLfhirPdpAERSjNbmjjECzGxHNJMiNKT3p 10 Merci pour la tarte" && exit 0
|
! [[ $dest && $amount ]] && echo "Des arguments sont manquants. Ex: pay Do99s6wQR2JLfhirPdpAERSjNbmjjECzGxHNJMiNKT3p 10 Merci pour la tarte" && return 2
|
||||||
|
|
||||||
#This shoudl works, but accents are ok and should not... [[ ! "$comment" =~ [^a-zA-Z0-9\ ] ]] && echo OK
|
#This shoudl works, but accents are ok and should not... [[ ! "$comment" =~ [^a-zA-Z0-9\ ] ]] && echo OK
|
||||||
[[ "$comment" =~ [^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-?:'('')'.+\ ] ]] && echo "Votre commentaire contient des charactères non autorisés." && exit 0
|
[[ "$comment" =~ [^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-?:'('')'.+\ ] ]] && echo "Votre commentaire contient des charactères non autorisés." && return 2
|
||||||
[[ -z "$comment" ]] && local comment="Transaction effectuee avec BoG."
|
[[ -z "$comment" ]] && local comment="Transaction effectuee avec BoG."
|
||||||
[[ $amount =~ '-' ]] && echo "La somme de votre transaction ne peut être négative: **$amount** Ḡ1" && exit 0
|
[[ $amount =~ '-' ]] && echo "La somme de votre transaction ne peut être négative: *$amount* Ḡ1" && return 2
|
||||||
[[ $(echo $dest | wc -c) -le 43 ]] && local dest=$(getPubkey $dest)
|
|
||||||
[[ $dest == "none" ]] && echo "Ce pseudo ne correspond à aucun membre Ḡ1 connu." && exit 0
|
|
||||||
|
|
||||||
|
[[ $(echo $dest | wc -c) -le 43 ]] && local dest=$(getPubkey $dest)
|
||||||
|
[[ $dest == "none" ]] && echo "Ce pseudo n'a pas de clé Ḡ1 associé." && return 2
|
||||||
|
|
||||||
|
toolDest=$(echo $dest1 | awk -F '@' '{ print $2 }')
|
||||||
|
chanDB "$1"
|
||||||
|
sender="$chan@$tool"
|
||||||
local result=$($silkaj --auth-file --file $homedir/secret.dunikey tx --amount $amount --output $dest --comment "$comment" -y)
|
local result=$($silkaj --auth-file --file $homedir/secret.dunikey tx --amount $amount --output $dest --comment "$comment" -y)
|
||||||
[[ -n $result ]] && echo "\`\`\`$result\`\`\`" || echo "Une erreur est survenu, votre transaction n'a pas été effecutée." && exit 0
|
resultCode=$?
|
||||||
|
[[ -n $result ]] && echo "\`\`\`$result\`\`\`" || (echo "Une erreur est survenu, votre transaction n'a pas été effecutée." && return 2)
|
||||||
|
[[ ${dest1#?} =~ '@' && $result && $resultCode == '0' && $toolDest != "telegram" ]] && sendmsg $dest1 "Vous avez reçus un paiement de *$amount Ḡ1* de la part de *$sender*\nCommentaire: *$comment*" || true
|
||||||
}
|
}
|
||||||
|
|
||||||
history_account() {
|
history_account() {
|
||||||
chanDB "$1"
|
chanDB "$1"
|
||||||
sendmsg $chan "Récupération de l'historique de votre compte **$pubkey** ..."
|
sendmsg $chan "Récupération de l'historique de votre compte *$pubkey* ..."
|
||||||
local result=$($silkaj history $pubkey)
|
local result=$($silkaj history $pubkey)
|
||||||
echo "\`\`\`$result\`\`\`"
|
echo "\`\`\`$result\`\`\`"
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,29 +10,37 @@ source $MY_PATH/functions.sh
|
||||||
|
|
||||||
pubkey() {
|
pubkey() {
|
||||||
local args=$(echo $@ | tr ' ' '\n' | grep -vEw 'biz|G1LibreBot' | tr '\n' ' ')
|
local args=$(echo $@ | tr ' ' '\n' | grep -vEw 'biz|G1LibreBot' | tr '\n' ' ')
|
||||||
[ $(echo $args | wc -w) -ge 3 ] && local username=$(echo $args | awk '{ print $3 }') || local username=$1
|
[ $(echo $args | wc -w) -ge 3 ] && local usernameK=$(echo $args | awk '{ print $3 }') || local usernameK=$1
|
||||||
local username=$(echo $username | tr -d '@')
|
# local usernameK=$(echo $usernameK | tr -d '@')
|
||||||
local pubkey=$(getPubkey $@)
|
[[ ${usernameK::1} == '@' ]] && usernameK=${usernameK#?}
|
||||||
[[ $pubkey ]] && echo "@$username Ta clé publique Ğ1 est: $pubkey" || echo "@$username n'est pas un pseudo membre de la Ḡ1"
|
local pubkey=$(getPubkey $args)
|
||||||
|
[[ ${usernameK::1} != '#' ]] && usernameK="@$usernameK"
|
||||||
|
[[ $pubkey == "none" ]] && echo "$usernameK n'a pas de clé Ḡ1 associé" || echo "$usernameK Ta clé publique Ğ1 est: *$pubkey*"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get Ḡ1 pseudo base on pubkey
|
# Get Ḡ1 pseudo base on pubkey
|
||||||
pseudo() { getPseudo $@; }
|
pseudo() { getPseudo $@; }
|
||||||
|
|
||||||
silkaj() {
|
silkaj() {
|
||||||
args=$(echo "$@" | tr ' ' '\n' | grep -vEw 'silkaj|biz|G1LibreBot' | tr '\n' ' ')
|
local args=$(echo "$@" | tr ' ' '\n' | grep -vEw 'silkaj|biz|G1LibreBot' | tr '\n' ' ')
|
||||||
cmd=$(echo $args | tr ' ' '\n' | grep -v '-' | head -n1)
|
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
|
[[ $cmd =~ ^(tx|authfile|cert)$ ]] && echo "BoḠ refuse d'executer la commande \`$cmd\` ... :eyes:" && exit 0
|
||||||
result=$($silkaj $args) || echo "Silkaj ne comprends cette commande."
|
local result=$($silkaj $args) || echo "Silkaj ne comprends cette commande."
|
||||||
echo "\`\`\`$result\`\`\`"
|
echo "\`\`\`$result\`\`\`"
|
||||||
}
|
}
|
||||||
|
|
||||||
membres() {
|
membres() {
|
||||||
url="$node/blockchain/current"
|
local url="$node/blockchain/current"
|
||||||
local nbr_membres=$(curl -m 10 -s $url | jq '.membersCount')
|
local nbr_membres=$(curl -m 10 -s $url | jq '.membersCount')
|
||||||
[[ $nbr_membres ]] && echo "Il y a actuellement $nbr_membres membres de la Ğ1 !" || echo "Service en maintenance, réessayez dans un instant :coffee:"
|
[[ $nbr_membres ]] && echo "Il y a actuellement $nbr_membres membres de la Ğ1 !" || echo "Service en maintenance, réessayez dans un instant :coffee:"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deb() {
|
||||||
|
local usernameK=$1
|
||||||
|
local cmd=$3
|
||||||
|
sleep 2
|
||||||
|
echo -e "coucou $usernameK\ncmd: *$cmd*"
|
||||||
|
}
|
||||||
|
|
||||||
[[ $(type $@ | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande"
|
[[ $(type $@ | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ remove() { rm_account "$dest"; }
|
||||||
info() { info_account "$dest"; }
|
info() { info_account "$dest"; }
|
||||||
pay() { tx "$dest" $args; }
|
pay() { tx "$dest" $args; }
|
||||||
history() { history_account "$dest"; }
|
history() { history_account "$dest"; }
|
||||||
|
mp() { sendmsg "$user" "$args"; }
|
||||||
|
|
||||||
[[ "$cmd" =~ ^(init|remove|info|pay|history)$ ]] && "$cmd" || echo "Veuillez indiquer une commande valide"
|
[[ "$cmd" =~ ^(init|remove|info|pay|history|mp)$ ]] && "$cmd"
|
||||||
|
[[ $? == 1 ]] && echo "Veuillez indiquer une commande valide"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Reference in New Issue