53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
const bot = require('bbot');
|
|
const exec = require('child_process').exec;
|
|
|
|
//ADMINS
|
|
var adminRooms = exec("pwd"); //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) {
|
|
cmd = "adherentsSoft"
|
|
} else {
|
|
cmd = "adherents"
|
|
}
|
|
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 ...")
|
|
} 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 survenu ...")
|
|
} else {
|
|
b.respond(stdout)
|
|
}
|
|
});
|
|
}, {
|
|
id: 'axiom-cagnotte'
|
|
});
|
|
|