f0ckv1/src/trigger/bot.js

28 lines
598 B
JavaScript
Raw Normal View History

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:43:52 +02:00
output: undefined,
2016-10-29 05:26:24 +02:00
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:43:52 +02:00
var output = util.inspect(sandbox.output);
if(output !== undefined)
e.reply(output);
2016-10-29 05:16:37 +02:00
},
desc: 'bot debug'
});
};