test
This commit is contained in:
parent
2912006129
commit
8fb995309a
@ -3,7 +3,8 @@ const vm = require('vm');
|
|||||||
|
|
||||||
module.exports = (lib) => {
|
module.exports = (lib) => {
|
||||||
const sandbox = {
|
const sandbox = {
|
||||||
bot: lib.bot
|
bot: lib.bot,
|
||||||
|
output: "nothing"
|
||||||
};
|
};
|
||||||
|
|
||||||
lib.trigger.add({
|
lib.trigger.add({
|
||||||
@ -13,10 +14,13 @@ module.exports = (lib) => {
|
|||||||
active: 1,
|
active: 1,
|
||||||
func: (e) => {
|
func: (e) => {
|
||||||
var args = e.message.trim().match(/^!bot (.*?)/i)[1];
|
var args = e.message.trim().match(/^!bot (.*?)/i)[1];
|
||||||
|
e.reply(args);
|
||||||
|
|
||||||
const script = new vm.Script(args);
|
const script = new vm.Script(args);
|
||||||
const context = new vm.createContext(sandbox);
|
const context = new vm.createContext(sandbox);
|
||||||
|
|
||||||
script.runInContext(context);
|
script.runInContext(context);
|
||||||
e.reply(util.inspect(sandbox));
|
e.reply(util.inspect(sandbox.output));
|
||||||
},
|
},
|
||||||
desc: 'bot debug'
|
desc: 'bot debug'
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user