Import bbot repo shell, inc and dunikey folders. Base for install.sh too
This commit is contained in:
parent
a40ca84ff8
commit
095976fcc2
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
|
||||
echo "Vérification de l'installation de BoḠ..."
|
||||
echo "ATTENTION: Ce script d'installation n'a pas été entièrement testé."
|
||||
|
||||
# Check if nvm, curl, node 12 and pm2 are installed
|
||||
install_require() {
|
||||
sudo apt update
|
||||
[[ ! $(which curl) ]] && sudo apt install curl
|
||||
[[ ! -f $HOME/.nvm/nvm.sh ]] && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
\. "$NVM_DIR/nvm.sh"
|
||||
nvm install 12
|
||||
nvm use 12
|
||||
[[ ! $(which pm2) ]] && npm install pm2 -g
|
||||
}
|
||||
|
||||
prepare_environment() {
|
||||
# Create .env files from templates
|
||||
[[ ! -f $MY_PATH/.env ]] && cp $MY_PATH/.env.template $MY_PATH/.env
|
||||
|
||||
# Install bbot
|
||||
# [[ ! -d $MY_PATH/node_modules/generator-hubot ]] && npm install -g yo generator-hubot
|
||||
|
||||
# Grant shell script executable
|
||||
chmod u+x $MY_PATH/src/shell/*
|
||||
|
||||
# Install duniterpy.key
|
||||
[[ ! $(pip3 freeze | grep duniterpy) ]] && pip3 install duniterpy || echo "duniterpy is still installed"
|
||||
|
||||
# install Silkaj
|
||||
sudo apt install libsodium23
|
||||
pip3 install silkaj --user --upgrade
|
||||
}
|
||||
|
||||
|
||||
install_require
|
||||
prepare_environment
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
# Author: Fred (support@qo-op.com)
|
||||
# Version: 2020.03.18
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
########################################################################
|
||||
# \\///
|
||||
# qo-op
|
||||
#############
|
||||
##########################
|
||||
#######################################
|
||||
####################################################
|
||||
########################################################################
|
||||
|
||||
MOTS=$(echo "$1" | grep -E "^\-?[0-9]+$")
|
||||
# Default is 6 words passphrase
|
||||
if [[ "$MOTS" == "" ]]; then MOTS=6; fi
|
||||
WORDCOUNT=${1-$MOTS}
|
||||
# Download the wordlist
|
||||
# wget -nc -O ~/.diceware-wordlist http://world.std.com/%7Ereinhold/diceware.wordlist.asc 2> /dev/null
|
||||
# print a list of the diceware words
|
||||
cat $MY_PATH/diceware-wordlist.txt | \
|
||||
awk '/[1-6][1-6][1-6][1-6][1-6]/{ print $2 }' | \
|
||||
# randomize the list order
|
||||
shuf --random-source=/dev/urandom | \
|
||||
# pick the first n words
|
||||
head -n ${WORDCOUNT} | \
|
||||
# pretty print
|
||||
tr '\n' ' ' | \
|
||||
# Remove last space
|
||||
rev | cut -c2- | rev
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python3
|
||||
# This Python script gets Duniter creddentials as arguments, and writes a PubSec file that should be compatible with Cesium and Silkaj(DuniterPy) clients.
|
||||
# launch with :
|
||||
# python3 key_create_dnuikey.py <id> <mdp>
|
||||
|
||||
# depends on duniterpy 0.56
|
||||
|
||||
### Licence - WTFPL
|
||||
# This script was written my Matograine, in the hope that it will be helpful.
|
||||
# Do What The Fuck you like with it. There is :
|
||||
# * no guarantee that this will work
|
||||
# * no support of any kind
|
||||
#
|
||||
# If this is helpful, please consider making a donation to the developper's pubkey : 78ZwwgpgdH5uLZLbThUQH7LKwPgjMunYfLiCfUCySkM8
|
||||
# Have fun
|
||||
|
||||
from sys import argv
|
||||
from duniterpy.key import SigningKey
|
||||
#import pathlib
|
||||
#MY_PATH = pathlib.Path(__file__).parent.absolute()
|
||||
|
||||
# path to save to
|
||||
path = "/tmp/secret.dunikey"
|
||||
#path = "{}/../shell/secret.dunikey".format(MY_PATH)
|
||||
|
||||
key = SigningKey.from_credentials(argv[1], argv[2], None)
|
||||
key.save_pubsec_file(path)
|
||||
print(
|
||||
key.pubkey,
|
||||
)
|
|
@ -0,0 +1,11 @@
|
|||
*Voici ce que je sais faire ...*
|
||||
|
||||
```
|
||||
- biz aide: Affiche cette aide
|
||||
- biz liens: Donne des liens utiles
|
||||
- index pads: Donne le lien vers l'index de nos pads
|
||||
- membres: Affiche le nombre de membres actuelles de la Ğ1
|
||||
- pubkey [pseudo]: Affiche sa propre clé publique Ğ1 si [pseudo] n'est pas renseigné, ou bien celle du pseudo indiqué
|
||||
- axiom adhérents: Affiche les adhérents de l'association
|
||||
- axiom cagnotte: Affiche le status de la cagnotte de l'association
|
||||
```
|
|
@ -0,0 +1,6 @@
|
|||
index pad !! https://pad.p2p.legal/axiom_index-pads
|
||||
Site officiel de l'association Axiom-Team !! https://axiom-team.fr/
|
||||
Forum de l'asso axiom-team !! https://forum.axiom-team.fr/
|
||||
Cloud publique axiom - Ressources Agora !! https://cloud.p2p.legal/s/DDbKi2pqdEmixS9
|
||||
Cloud interne axiom _(Nécessite un accès)_ !! https://cloud.p2p.legal/f/204193`
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
5 personnes membres vous connaissent-elles bien ? Peuvent-elles vous contacter ? Contacter votre entourage ? Avez-vous sauvegardé votre document de révocation ? Avez-vous installé un client local sur votre ordinateur/smartphone comme Cesium ?
|
||||
|
||||
Si oui -> vous connaissez certainement ces personnes vous aussi, et pouvez leur demander.
|
||||
Si non -> il va vous falloir créer des liens avec des membres, conformément à la **[licence](https://duniter.org/fr/wiki/licence-g1/)** que vous devez lire, comprendre et accepter.
|
||||
|
||||
Je vous invite également à lire le **[guide du débutant](https://forum.monnaie-libre.fr/t/00-intro-guide-du-debutant-en-monnaie-libre-g1-june/2777)**, et surtout à vous renseigner sur les rencontres de présentation de la monnaie libre autour de chez vous, pour créer des relations humaines réelles.
|
||||
|
||||
Bienvenue, et bonnes découvertes !
|
|
@ -0,0 +1,6 @@
|
|||
OBSCURANTISTE!
|
||||
MENTEUR!
|
||||
Toute mlc ne sert qu'à nuire à l’eveil de conscience sur la création monétaire.
|
||||
Avez vous déjà vérifié les arguments (fallacieux) servis par les rabatteurs de mlc?
|
||||
Les mlc coutent un bras au profit des banques et de quelques « chiens de garde» de leur salaire en unl qui en découle (rabatteurs).
|
||||
La plus grosse mlc de l’histoire j’ai analysé: La mlc argentine en 2001. Elle a permis l’emergence de Monsanto compagny en 2002. N’hésitez pas à vérifier.
|
|
@ -7,7 +7,7 @@ module.exports = (robot) => {
|
|||
|
||||
robot.hear(/mlc/i, function (msg) {
|
||||
|
||||
let bizbi = fs.readFileSync('../bog/src/inc/repliques-mlc.txt', 'utf8');
|
||||
let bizbi = fs.readFileSync('scripts/inc/repliques-mlc.txt', 'utf8');
|
||||
bizbi = bizbi.split('\n')
|
||||
function randomize(toRand) {
|
||||
resultRand = toRand[Math.floor(Math.random()*toRand.length)]
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../../bog/src/shell/
|
|
@ -0,0 +1,4 @@
|
|||
API_TOKEN=""
|
||||
API_ID=""
|
||||
node=""
|
||||
silkaj="$HOME/.local/bin/silkaj -p $node"
|
|
@ -0,0 +1,26 @@
|
|||
#!/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
|
||||
|
||||
#cmds=$(grep "^bot\." *.js -A3 | grep -E "\['|aide = ")
|
||||
cmds=$(grep "\['" *.js | awk -F "[" '{ print $2 }' | awk -F "]" '{ print $1 }')
|
||||
IFS=$'\n'
|
||||
for i in $cmds; do
|
||||
echo "$i" | awk -F "'" '{ print $2 }'
|
||||
done
|
||||
}
|
||||
|
||||
text() {
|
||||
cat $MY_PATH/../inc/aide.txt
|
||||
}
|
||||
|
||||
#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
|
|
@ -0,0 +1,178 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
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)
|
||||
|
||||
function DEBUG()
|
||||
{
|
||||
[ "$_DEBUG" == "on" ] && $@
|
||||
}
|
||||
|
||||
chanDB() {
|
||||
if [[ "$1" =~ '@' ]]; then
|
||||
chan=$(echo "$1" | awk -F '@' '{ print $1 }')
|
||||
tool=$(echo "$1" | awk -F '@' '{ print $2 }')
|
||||
else
|
||||
chan="$1"
|
||||
fi
|
||||
[[ ! $chan ]] && echo "Please select user." && return 2
|
||||
if [[ "$chan" =~ '#' ]]; then
|
||||
homedir="$HOME/.bog/ids/$tool/$chan"
|
||||
else
|
||||
homedir="$HOME/.bog/ids/$tool/@$chan"
|
||||
fi
|
||||
DEBUG echo "_${FUNCNAME[0]}_: $chan"
|
||||
DEBUG echo "_${FUNCNAME[0]}_: $tool"
|
||||
DEBUG echo "_${FUNCNAME[0]}_: $homedir"
|
||||
[[ -f $homedir/db ]] && source $homedir/db
|
||||
}
|
||||
|
||||
# Send a message
|
||||
sendmsg() {
|
||||
chanDB "$1"
|
||||
[[ ! "${chan::1}" =~ ^(#|@)$ ]] && chan="@$chan"
|
||||
local msg="${@:2}"
|
||||
|
||||
[[ ! $chan || ! $msg ]] && echo "Please select user and message." && return 2
|
||||
|
||||
DEBUG echo "_${FUNCNAME[0]}_: $chan"
|
||||
DEBUG echo "_${FUNCNAME[0]}_: $tool"
|
||||
|
||||
if [[ $tool == "axiomchat" ]]; then
|
||||
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() {
|
||||
url="$node/wot/members"
|
||||
# [[ -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 }')
|
||||
[[ ! $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"
|
||||
exit 0
|
||||
}
|
||||
|
||||
getPseudo() {
|
||||
url="$node/wot/members"
|
||||
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 '@')
|
||||
local pseudo=$(curl -m 10 -s $url | jq -r --arg pubkey "$pubkey" '.results[] | select(.pubkey==$pubkey) | .uid')
|
||||
[[ $pseudo ]] && echo "Le pseudo correspondant à la clé publique $pubkey est: @$pseudo" || echo "La clé publique $pubkey n'a pas de pseudo associé."
|
||||
}
|
||||
|
||||
getPassword() {
|
||||
chanDB "$1"
|
||||
if [[ -d $homedir ]]; then
|
||||
sendmsg $chan "Voici les identifiants de connexion de votre ḠCompte: \n \
|
||||
Login: *$salt*\nMot de passe: *$pepper*\nClé publique: *$pubkey* \n \
|
||||
Calcul du solde de votre compte en cours ..."
|
||||
else
|
||||
echo "Vous n'avez pas de compte chez nous."
|
||||
fi
|
||||
}
|
||||
|
||||
info_account() {
|
||||
chanDB "$1"
|
||||
if [[ -d $homedir ]]; then
|
||||
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-)
|
||||
echo "Votre solde est de *$solde*"
|
||||
else
|
||||
echo "Vous n'avez pas de compte chez nous."
|
||||
fi
|
||||
}
|
||||
|
||||
init_account() {
|
||||
chanDB "$1"
|
||||
if [[ -f $homedir/secret.dunikey ]]; then
|
||||
pubkey=$(cat $homedir/secret.dunikey| grep "pub: " | awk '{ print $2 }')
|
||||
echo "Vous disposez déjà d'un portefeuille Ḡ1: *$pubkey*"
|
||||
return 2
|
||||
else
|
||||
sendmsg $dest "Création de votre portefeuille..."
|
||||
fi
|
||||
|
||||
# LOGIN (=SALT)
|
||||
local salt="$($MY_PATH/../dunikey/diceware.sh 6)"
|
||||
# PASS (=PEPPER)
|
||||
local pepper="$($MY_PATH/../dunikey/diceware.sh 4)"
|
||||
# The pubkey for this salt/papper peer
|
||||
local pubkey=$(python3 $MY_PATH/../dunikey/key_create_dunikey.py "$salt" "$pepper")
|
||||
|
||||
[[ ! -f /tmp/secret.dunikey ]] && echo "Arf, problem happens making your secret.dunikey" && return 2
|
||||
[[ ! -d $homedir ]] && mkdir -p $homedir
|
||||
[[ -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
|
||||
|
||||
# info_account $chan
|
||||
echo -e "Votre ḠCompte a bien été créé.\nPubkey: *$pubkey*"
|
||||
}
|
||||
|
||||
rm_account() {
|
||||
chanDB "$1"
|
||||
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 -e "Login: *$salt*\nMot de passe: *$pepper*\nClé publique: *$pubkey*"
|
||||
rm -r $homedir
|
||||
echo "Suppression terminé, nous ne disposons plus d'aucune donnée vous concernant."
|
||||
else
|
||||
echo "Vous n'avez pas de compte chez nous."
|
||||
fi
|
||||
}
|
||||
|
||||
tx() {
|
||||
local dest="$2"
|
||||
local dest1="$dest"
|
||||
local amount=$(echo "$3" | tr ',' '.')
|
||||
local comment="${@:4}"
|
||||
|
||||
! [[ $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
|
||||
[[ "$comment" =~ [^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-?:'('')'.+\ ] ]] && echo "Votre commentaire contient des charactères non autorisés." && return 2
|
||||
[[ -z "$comment" ]] && local comment="Transaction effectuee avec BoG."
|
||||
[[ $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 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)
|
||||
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() {
|
||||
chanDB "$1"
|
||||
sendmsg $chan "Récupération de l'historique de votre compte *$pubkey* ..."
|
||||
local result=$($silkaj history $pubkey)
|
||||
echo "\`\`\`$result\`\`\`"
|
||||
}
|
||||
|
||||
#[[ $(type $1 | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande"
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
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)
|
||||
source $MY_PATH/functions.sh
|
||||
|
||||
# Get Ḡ1 pubkey base on pseudo
|
||||
|
||||
pubkey() {
|
||||
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"
|
||||
[[ $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
|
||||
pseudo() { getPseudo $@; }
|
||||
|
||||
silkaj() {
|
||||
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
|
||||
\`\`\`"
|
||||
}
|
||||
|
||||
membres() {
|
||||
local url="$node/blockchain/current"
|
||||
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:"
|
||||
}
|
||||
|
||||
deb() {
|
||||
local usernameK=$1
|
||||
local cmd=$3
|
||||
sleep 2
|
||||
echo -e "coucou $usernameK\ncmd: *$cmd*"
|
||||
}
|
||||
|
||||
[[ $(type $1 | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande"
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,26 @@
|
|||
#!/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 $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 }')
|
||||
room=$(echo "$@" | awk -F '~~~' '{ print $3 }')
|
||||
|
||||
[[ $room == "undefined" ]] && dest="$user" || dest="#$room"
|
||||
|
||||
init() { init_account "$dest"; }
|
||||
remove() { rm_account "$dest"; }
|
||||
info() { info_account "$dest"; }
|
||||
pay() { tx "$dest" $args; }
|
||||
history() { history_account "$dest"; }
|
||||
mp() { sendmsg "$user" "$args"; }
|
||||
|
||||
[[ "$cmd" =~ ^(init|remove|info|pay|history|mp)$ ]] && "$cmd"
|
||||
[[ $? == 1 ]] && echo "Veuillez indiquer une commande valide"
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
ids="axiom-team:tYrjD6rrfStJXBqHhzNET"
|
||||
ha="https://api.helloasso.com/v3"
|
||||
|
||||
adherents() {
|
||||
url="$ha/campaigns/000001053192/actions.json?type"
|
||||
curl -m 5 --user $ids -s $url | jq -r '.resources[] | .date + " , " + .first_name + " " + .last_name + " - " + .email' | sed 's/T.*,//'
|
||||
}
|
||||
|
||||
adherentsSoft() {
|
||||
url="$ha/campaigns/000001053192/actions.json?type"
|
||||
curl -m 5 --user $ids -s $url | jq -r '.resources[] | .date + " , " + .first_name + " " + .last_name' | sed 's/T.*,//'
|
||||
}
|
||||
|
||||
|
||||
cagnotte() {
|
||||
url="$ha/campaigns/000001053192.json"
|
||||
curl -m 5 --user $ids -s $url | jq -r '.name, {"Donnateurs": .supporters},{"Fonds":.funding},.url' | grep -vE '{|}'
|
||||
}
|
||||
|
||||
|
||||
[[ $(type $@ | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande"
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z $3 ]]; then
|
||||
res=$(sed 's/!!/:arrow_right:/g' scripts/inc/liens.txt)
|
||||
else
|
||||
shift 2
|
||||
res=$(sed 's/!!/:arrow_right:/g' scripts/inc/liens.txt | grep -i "$@")
|
||||
fi
|
||||
|
||||
[[ $res ]] && echo "$res" || echo "Aucun lien trouvé avec **$@**"
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue