dbot/modules/js.js

23 lines
424 B
JavaScript
Raw Normal View History

var vm = require('vm');
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);
dbot.say(data.channel, vm.runInNewContext(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);
};