2012-02-13 20:56:04 +01:00
|
|
|
var vm = require('vm');
|
2012-02-13 21:18:01 +01:00
|
|
|
var s = require('sandbox');
|
2012-02-13 20:56:04 +01:00
|
|
|
|
2011-10-12 17:42:19 +02:00
|
|
|
var js = function(dbot) {
|
|
|
|
var dbot = dbot;
|
|
|
|
|
|
|
|
var commands = {
|
|
|
|
'~js': function(data, params) {
|
2011-10-12 17:55:46 +02:00
|
|
|
var q = data.message.valMatch(/^~js (.*)/, 2);
|
2012-02-13 21:11:51 +01:00
|
|
|
s.run(q[1], function(output) {
|
|
|
|
dbot.say(data.channel, output.result);
|
|
|
|
});
|
2012-02-13 21:01:22 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
'~ajs': function(data, params) {
|
|
|
|
var q = data.message.valMatch(/^~ajs (.*)/, 2);
|
|
|
|
if(data.user == dbot.admin) {
|
|
|
|
dbot.say(data.channel, eval(q[1]));
|
|
|
|
}
|
2011-10-12 17:42:19 +02:00
|
|
|
}
|
|
|
|
};
|
2011-10-12 17:43:09 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
'onLoad': function() {
|
|
|
|
return commands;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.fetch = function(dbot) {
|
|
|
|
return js(dbot);
|
|
|
|
};
|