test
This commit is contained in:
parent
9e69dd4e33
commit
2912006129
23
src/trigger/bot.js
Normal file
23
src/trigger/bot.js
Normal 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'
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user