2020-07-12 03:06:41 +02:00
|
|
|
const bot = require('bbot');
|
|
|
|
const exec = require('child_process').exec;
|
|
|
|
const fs = require('fs');
|
|
|
|
const util = require('util')
|
|
|
|
|
|
|
|
bot.global.text({
|
2020-07-23 02:16:31 +02:00
|
|
|
starts: ['./gbanque', 'biz ./gbanque', 'biz gb', 'gb']
|
2020-07-12 03:06:41 +02:00
|
|
|
}, (b) => {
|
2020-08-07 19:03:13 +02:00
|
|
|
tool="axiomchat"
|
2020-07-12 03:06:41 +02:00
|
|
|
room = b.message.user.room.name
|
2020-08-07 19:03:13 +02:00
|
|
|
process.env.hb_cmd = b.message.text
|
2020-09-04 01:47:58 +02:00
|
|
|
process.env.hb_username = b.message.user.name + "@" + tool
|
2020-07-12 03:06:41 +02:00
|
|
|
|
2020-08-07 19:03:13 +02:00
|
|
|
if (typeof room === 'undefined' || room === null) {
|
|
|
|
process.env.hb_room = room
|
|
|
|
} else {
|
|
|
|
process.env.hb_room = room + "@" + tool
|
|
|
|
}
|
|
|
|
|
|
|
|
gbanque = exec("src/shell/gbanque.sh $hb_cmd~~~$hb_username~~~$hb_room", function(err, stdout, stderr) {
|
2020-07-12 03:06:41 +02:00
|
|
|
if (err) {
|
2020-07-23 02:16:31 +02:00
|
|
|
b.respond("Une erreur est survenu: " + stderr)
|
2020-07-12 03:06:41 +02:00
|
|
|
} else {
|
2020-09-04 01:47:58 +02:00
|
|
|
if (stdout) { b.respond(stdout); }
|
2020-07-12 03:06:41 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}, {
|
|
|
|
id: 'gbanque'
|
|
|
|
});
|