f0ckv1/src/trigger/bot.js

27 lines
545 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) => {
const 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',
call: /^!bot (.*)/i,
level: 100,
active: 1,
func: (e) => {
2016-10-29 05:26:24 +02:00
var args = e.message.match(/^!bot (.*?)/i)[1];
2016-10-29 05:21:35 +02:00
e.reply(args);
2016-10-29 05:26:24 +02:00
sandbox.e = e;
2016-10-29 05:21:35 +02:00
2016-10-29 05:26:24 +02:00
vm.runInNewContext(args, sandbox);
2016-10-29 05:21:35 +02:00
2016-10-29 05:26:24 +02:00
e.reply(util.inspect(sandbox['output']));
2016-10-29 05:16:37 +02:00
},
desc: 'bot debug'
});
};