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