2016-10-29 05:16:37 +02:00
|
|
|
const util = require('util');
|
|
|
|
const vm = require('vm');
|
|
|
|
|
|
|
|
module.exports = (lib) => {
|
2016-10-29 05:35:11 +02:00
|
|
|
var sandbox = {
|
2016-10-29 05:21:35 +02:00
|
|
|
bot: lib.bot,
|
2016-10-29 05:26:24 +02:00
|
|
|
output: "nothing",
|
|
|
|
e: null
|
2016-10-29 05:16:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
lib.trigger.add({
|
|
|
|
name: 'bot debug',
|
2016-10-29 05:35:11 +02:00
|
|
|
call: /^\!bot (.*)/i,
|
2016-10-29 05:16:37 +02:00
|
|
|
level: 100,
|
|
|
|
active: 1,
|
|
|
|
func: (e) => {
|
2016-10-29 05:35:11 +02:00
|
|
|
var args = e.message.match(/^\!bot (.*)/i)[1];
|
2016-10-29 05:26:24 +02:00
|
|
|
sandbox.e = e;
|
2016-10-29 05:21:35 +02:00
|
|
|
|
2016-10-29 05:38:21 +02:00
|
|
|
vm.runInNewContext('this.output = '+args, sandbox);
|
2016-10-29 05:21:35 +02:00
|
|
|
|
2016-10-29 05:37:01 +02:00
|
|
|
e.reply(util.inspect(sandbox.output));
|
2016-10-29 05:16:37 +02:00
|
|
|
},
|
|
|
|
desc: 'bot debug'
|
|
|
|
});
|
|
|
|
};
|