This commit is contained in:
Flummi 2016-10-29 05:16:37 +02:00
parent 9e69dd4e33
commit 2912006129

23
src/trigger/bot.js Normal file
View File

@ -0,0 +1,23 @@
const util = require('util');
const vm = require('vm');
module.exports = (lib) => {
const sandbox = {
bot: lib.bot
};
lib.trigger.add({
name: 'bot debug',
call: /^!bot (.*)/i,
level: 100,
active: 1,
func: (e) => {
var args = e.message.trim().match(/^!bot (.*?)/i)[1];
const script = new vm.Script(args);
const context = new vm.createContext(sandbox);
script.runInContext(context);
e.reply(util.inspect(sandbox));
},
desc: 'bot debug'
});
};