Fix axiom adhérent in bbot scripts and improve shell
This commit is contained in:
parent
ef332a91a3
commit
1da87b7002
|
@ -0,0 +1 @@
|
|||
biz-bot-admin
|
|
@ -8,7 +8,7 @@ bot.global.text({
|
|||
}, (b) => {
|
||||
membres = exec("src/shell/aide.sh text", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu ...")
|
||||
b.respond("Une erreur est survenue ...")
|
||||
} else {
|
||||
b.respond(stdout)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ const bot = require('bbot');
|
|||
const exec = require('child_process').exec;
|
||||
|
||||
//ADMINS
|
||||
var adminRooms = exec("pwd"); //cat admins-chan.txt");
|
||||
//var adminRooms = exec("cat admins-chan.txt"); //cat admins-chan.txt");
|
||||
|
||||
bot.global.text({
|
||||
contains: ['axiom adhérent','axiom adhérents','axiom adherent','axiom adherents']
|
||||
|
@ -16,18 +16,19 @@ bot.global.text({
|
|||
roomName = b.message.user.name
|
||||
}
|
||||
|
||||
b.respond("JE SUIS LA" + adminRooms.) //kopa
|
||||
// b.respond("JE SUIS LA" + adminRooms.) //kopa
|
||||
|
||||
if (adminRooms.indexOf(roomName) == -1) {
|
||||
cmd = "adherentsSoft"
|
||||
} else {
|
||||
// if (adminRooms.indexOf(roomName) == -1) {
|
||||
if (['biz-bot-admin', 'poka', 'brad.pi', '_pole_financements', '_axiom_business_plan', 'compta-axiom', 'communication', '_recrutement'].includes(roomName)) {
|
||||
cmd = "adherents"
|
||||
process.env.hb_cmd = cmd
|
||||
} else {
|
||||
b.respond("Réservé aux administrateurs de l'association.")
|
||||
}
|
||||
process.env.hb_cmd = cmd
|
||||
|
||||
pubkey = exec("src/shell/helloasso.sh $hb_cmd", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu ...")
|
||||
b.respond("Une erreur est survenue ...")
|
||||
} else {
|
||||
b.respond(stdout)
|
||||
}
|
||||
|
@ -41,7 +42,7 @@ bot.global.text({
|
|||
}, (b) => {
|
||||
membres = exec("src/shell/helloasso.sh cagnotte", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu ...")
|
||||
b.respond("Une erreur est survenue ...")
|
||||
} else {
|
||||
b.respond(stdout)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ bot.global.text({
|
|||
}, (b) => {
|
||||
membres = exec("src/shell/.sh", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu ...")
|
||||
b.respond("Une erreur est survenue ...")
|
||||
} else {
|
||||
b.respond(stdout)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ bot.global.text({
|
|||
process.env.hb_cmd = cmd
|
||||
pubkey = exec("src/shell/g1-infos.sh pubkey $hb_username \"$hb_cmd\"", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu ...")
|
||||
b.respond("Une erreur est survenue ...")
|
||||
} else {
|
||||
b.respond(stdout)
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ bot.global.text({
|
|||
}, (b) => {
|
||||
membres = exec("src/shell/g1-infos.sh membres", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu ...")
|
||||
b.respond("Une erreur est survenue ...")
|
||||
} else {
|
||||
b.respond(stdout)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ bot.global.text({
|
|||
const username = b.message.user.id
|
||||
membres = exec("g1sms/test.sh chat", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu ...")
|
||||
b.respond("Une erreur est survenue ...")
|
||||
} else {
|
||||
b.respond(stdout)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ bot.global.text({
|
|||
process.env.hb_cmd = cmd
|
||||
membres = exec("src/shell/liens.sh $hb_cmd", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu ...")
|
||||
b.respond("Une erreur est survenue ...")
|
||||
} else {
|
||||
b.respond(stdout)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ const globe_delay = 60000; // 1 minute
|
|||
var globe_said = {};
|
||||
|
||||
bot.global.text({
|
||||
contains: ['facebook', 'google', 'amazon', 'apple', 'microsoft']
|
||||
contains: ['facebook', 'google', 'amazon', 'apple', 'microsoft', 'youtube']
|
||||
}, (b) => {
|
||||
b.respondVia('react', ':hear_no_evil:');
|
||||
}, {
|
||||
|
|
|
@ -7,7 +7,7 @@ bot.global.text({
|
|||
function reload() {
|
||||
pubkey = exec("pm2 reload bbot --force", function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
b.respond("Une erreur est survenu: " + " - " + stderr)
|
||||
b.respond("Une erreur est survenue: " + " - " + stderr)
|
||||
} else {
|
||||
b.respond("Biz a été rechargé")
|
||||
}
|
||||
|
|
|
@ -5,7 +5,15 @@ 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.*,//'
|
||||
list=$(curl -m 5 --user $ids -s $url | jq -r '.resources[] | .date + " , " + .first_name + " " + .last_name + " - " + .email' | sed 's/T.*,//')
|
||||
|
||||
echo "$list" | awk '!seen[$3]++'
|
||||
|
||||
nbrAdherents=$(echo "$list" | awk '!seen[$3]++' | wc -l)
|
||||
|
||||
echo "---"
|
||||
echo -e "\n Il y a actuellement **$nbrAdherents adhérents** de l'association Axiom-Team."
|
||||
|
||||
}
|
||||
|
||||
adherentsSoft() {
|
||||
|
@ -16,7 +24,16 @@ adherentsSoft() {
|
|||
|
||||
cagnotte() {
|
||||
url="$ha/campaigns/000001053192.json"
|
||||
curl -m 5 --user $ids -s $url | jq -r '.name, {"Donnateurs": .supporters},{"Fonds":.funding},.url' | grep -v '{|}'
|
||||
list=$(curl -m 5 --user $ids -s $url | jq -r '.name, {"Donnateurs": .supporters},{"Fonds":.funding},.url' | tr -d '{|}')
|
||||
# list=$(curl -m 5 --user $ids -s $url | jq -r '{"Donnateurs": .supporters},{"Fonds":.funding},.url' | tr -d '{|}')
|
||||
|
||||
name=$(echo "$list" | head -n1)
|
||||
url=$(echo "$list" | tail -n1)
|
||||
donnateurs=$(echo "$list" | grep "Donnateurs" | awk '{ print $2 }')
|
||||
fonds=$(echo "$list" | grep "Fonds" | awk '{ print $2 }')
|
||||
|
||||
echo "Il y a **${fonds}€** pour **$donnateurs donnateurs** sur la cagnotte **\"$name\"**"
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue