var Sandbox = require("sandbox"); var s = new Sandbox({ timeout: 2000 }); let sbhead = "\"use strict\";"; sbhead += Object.getOwnPropertyNames(Math).map(function(v){return "const " + v + "=Math." + v + ";" + (typeof Math[v] == "function" ? v + ".bind(Math);" : "")}).join(""); module.exports = (lib) => { lib.trigger.add({ name: 'test', call: /^!test (.*)/i, level: 100, active: 1, func: (e) => { var args = e.message.trim().match(/^!test (.*)/i)[1]; s.run(sbhead + args, (out) => { let con = out.console.length > 0 ? " and printed to console: " + out.console : ""; let text = (out.result + con).replace(/[\r\n\t]/g, " "); e.reply(e.user.getNick() + " it returned: " + (text.length > 400 ? "f0ck you" : text)); }); }, desc: 'muh' }); };