commit
b1fcf5c044
@ -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",
|
||||
|
26
src/trigger/sandbox.js
Normal file
26
src/trigger/sandbox.js
Normal file
@ -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'
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user