3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00
dbot/modules/youare.js

23 lines
639 B
JavaScript
Raw Normal View History

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