diff --git a/package.json b/package.json index a6a0772..b9b996c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "request": "^2.74.0", "swig": "^1.4.2", "uuid": "^2.0.2", - "ytdl-core": "^0.7.17" + "ytdl-core": "^0.7.17", + "safe-eval": "^0.3.0" }, "repository": { "type": "git", diff --git a/src/trigger/sandbox.js b/src/trigger/sandbox.js new file mode 100644 index 0000000..65bd43f --- /dev/null +++ b/src/trigger/sandbox.js @@ -0,0 +1,26 @@ +var safeEval = require('safe-eval'); + +module.exports = (lib) => { + lib.trigger.add({ + name: 'sandbox', + call: /^\!js (.*)/i, + level: 100, + active: 1, + func: (e) => { + var args = e.message.match(/^\!js (.*)/i)[1]; + var context = { + bot: lib.bot, + e: e + } + try { + var output = safeEval(args, context); + if(typeof(output) != undefined && output !== 'undefined' && output) + e.reply(output); + } + catch(blah) { + e.reply('f0ck you!'); + } + }, + desc: 'sandbox' + }); +}; \ No newline at end of file