From 8fb995309ad66454c141c88817c436a644017d10 Mon Sep 17 00:00:00 2001 From: Flummi Date: Sat, 29 Oct 2016 05:21:35 +0200 Subject: [PATCH] test --- src/trigger/bot.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/trigger/bot.js b/src/trigger/bot.js index 9502711..be8f66a 100644 --- a/src/trigger/bot.js +++ b/src/trigger/bot.js @@ -3,7 +3,8 @@ const vm = require('vm'); module.exports = (lib) => { const sandbox = { - bot: lib.bot + bot: lib.bot, + output: "nothing" }; lib.trigger.add({ @@ -13,10 +14,13 @@ module.exports = (lib) => { active: 1, func: (e) => { var args = e.message.trim().match(/^!bot (.*?)/i)[1]; + e.reply(args); + const script = new vm.Script(args); const context = new vm.createContext(sandbox); + script.runInContext(context); - e.reply(util.inspect(sandbox)); + e.reply(util.inspect(sandbox.output)); }, desc: 'bot debug' });