33 lines
873 B
JavaScript
33 lines
873 B
JavaScript
const bot = require('bbot');
|
|
const exec = require('child_process').exec;
|
|
const fs = require('fs');
|
|
const util = require('util')
|
|
|
|
bot.global.text({
|
|
starts: ['./gbanque', 'biz ./gbanque', 'biz gb', 'gb']
|
|
}, (b) => {
|
|
tool="axiomchat"
|
|
room = b.message.user.room.name
|
|
process.env.hb_cmd = b.message.text
|
|
|
|
if (typeof room === 'undefined' || room === null) {
|
|
process.env.hb_username = b.message.user.name + "@" + tool
|
|
process.env.hb_room = room
|
|
} else {
|
|
process.env.hb_username = b.message.user.name + "@" + tool
|
|
// process.env.hb_username = b.message.user.name
|
|
process.env.hb_room = room + "@" + tool
|
|
}
|
|
|
|
gbanque = exec("src/shell/gbanque.sh $hb_cmd~~~$hb_username~~~$hb_room", function(err, stdout, stderr) {
|
|
if (err) {
|
|
b.respond("Une erreur est survenu: " + stderr)
|
|
} else {
|
|
b.respond(stdout)
|
|
}
|
|
});
|
|
|
|
}, {
|
|
id: 'gbanque'
|
|
});
|