mirror of
https://github.com/reality/dbot.git
synced 2024-11-24 04:49:25 +01:00
33 lines
727 B
JavaScript
33 lines
727 B
JavaScript
var vm = require('vm');
|
|
var s = require('sandbox')();
|
|
|
|
var js = function(dbot) {
|
|
var dbot = dbot;
|
|
|
|
var commands = {
|
|
'~js': function(data, params) {
|
|
var q = data.message.valMatch(/^~js (.*)/, 2);
|
|
s.run(q[1], function(output) {
|
|
dbot.say(data.channel, output.result);
|
|
});
|
|
},
|
|
|
|
'~ajs': function(data, params) {
|
|
var q = data.message.valMatch(/^~ajs (.*)/, 2);
|
|
if(data.user == dbot.admin) {
|
|
dbot.say(data.channel, eval(q[1]));
|
|
}
|
|
}
|
|
};
|
|
|
|
return {
|
|
'onLoad': function() {
|
|
return commands;
|
|
}
|
|
};
|
|
};
|
|
|
|
exports.fetch = function(dbot) {
|
|
return js(dbot);
|
|
};
|