f0ckv1/src/trigger/test.js

24 lines
836 B
JavaScript
Raw Normal View History

2016-10-29 05:06:46 +02:00
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("");
2016-09-15 00:05:18 +02:00
module.exports = (lib) => {
2016-09-09 11:18:03 +00:00
lib.trigger.add({
2016-09-08 15:42:38 +00:00
name: 'test',
2016-10-29 05:06:46 +02:00
call: /^!test (.*)/i,
level: 100,
active: 1,
2016-09-08 15:42:38 +00:00
func: (e) => {
2016-10-29 05:06:46 +02:00
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));
});
2016-09-08 15:42:38 +00:00
},
2016-09-13 00:39:21 +02:00
desc: 'muh'
2016-09-08 15:42:38 +00:00
});
};