54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
const bot = require('bbot');
|
|
const exec = require('child_process').exec;
|
|
|
|
//ADMINS
|
|
//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']
|
|
}, (b) => {
|
|
// cmd = b.message.text
|
|
// roomName = b.message.user.room.name
|
|
|
|
if (b.message.user.room.type == "p") {
|
|
roomName = b.message.user.room.name
|
|
} else {
|
|
roomName = b.message.user.name
|
|
}
|
|
|
|
// b.respond("JE SUIS LA" + adminRooms.) //kopa
|
|
|
|
// 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.")
|
|
}
|
|
|
|
pubkey = exec("src/shell/helloasso.sh $hb_cmd", function(err, stdout, stderr) {
|
|
if (err) {
|
|
b.respond("Une erreur est survenue ...")
|
|
} else {
|
|
b.respond(stdout)
|
|
}
|
|
});
|
|
}, {
|
|
id: 'axiom-adherents'
|
|
});
|
|
|
|
bot.global.text({
|
|
contains: ['axiom cagnotte']
|
|
}, (b) => {
|
|
membres = exec("src/shell/helloasso.sh cagnotte", function(err, stdout, stderr) {
|
|
if (err) {
|
|
b.respond("Une erreur est survenue ...")
|
|
} else {
|
|
b.respond(stdout)
|
|
}
|
|
});
|
|
}, {
|
|
id: 'axiom-cagnotte'
|
|
});
|
|
|