3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00

ok the regex was broke

This commit is contained in:
Luke Slater 2011-08-25 14:34:51 +01:00
parent e62bacfa98
commit 85f4747dcb

View File

@ -3,11 +3,15 @@ var youAre = function(dbot) {
return { return {
'listener': function(data) { 'listener': function(data) {
var num = Math.floor(Math.random()*11); var num = Math.floor(Math.random()*6);
var key = data.message.match(/ is|are ([\d\w\s']*),?\.?and?/); var key = data.message.match(/(is|are) ([\d\w\s']*),?\.?/);
if(num == 1 && key != undefined) { if(num == 1 && key != undefined) {
dbot.say(data.channel, data.user + ': You\'re ' + key[1]); 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]);
} }
}, },