3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00
dbot/modules/youare.js
Luke Slater 7c023104e3 meh
2011-08-25 15:47:06 +01:00

25 lines
636 B
JavaScript

var youAre = function(dbot) {
var dbot = dbot;
return {
'listener': function(data) {
var num = Math.floor(Math.random()*4);
var key = data.message.match(/(is|are) ([\d\w\s']*)/);
if(num == 1 && key != undefined) {
if(key[2].indexOf('and') !== -1) {
key[2] = key[2].split('and')[0];
} // TODO: fix the regex to do this. i hate regex
dbot.say(data.channel, data.user + ': You\'re ' + key[2]);
}
},
'on': 'PRIVMSG'
};
};
exports.fetch = function(dbot) {
return youAre(dbot);
};