This commit is contained in:
Flummi 2016-10-29 06:00:37 +02:00
parent 680230abc1
commit 12f2f8cbdc

View File

@ -1,14 +1,6 @@
//const util = require('util');
//const vm = require('vm');
var safeEval = require('safe-eval');
module.exports = (lib) => {
//var sandbox = {
// bot: lib.bot,
// output: undefined,
// e: null
//};
lib.trigger.add({
name: 'bot debug',
call: /^\!bot (.*)/i,
@ -16,18 +8,13 @@ module.exports = (lib) => {
active: 1,
func: (e) => {
var args = e.message.match(/^\!bot (.*)/i)[1];
var context = {
bot: lib.bot,
e: e
}
e.reply( safeEval(args, context) );
//sandbox.e = e;
//vm.runInNewContext('this.output = '+args, sandbox);
//var output = util.inspect(sandbox.output);
//if(typeof(output) !== undefined)
// e.reply(output);
var output = safeEval(args, context);
if(typeof(output) != undefined)
e.reply(output);
},
desc: 'bot debug'
});