From 85f4747dcbc5fd92c864f09bf42fecada82560ea Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Thu, 25 Aug 2011 14:34:51 +0100 Subject: [PATCH] ok the regex was broke --- modules/youare.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/youare.js b/modules/youare.js index 2190433..beeb984 100644 --- a/modules/youare.js +++ b/modules/youare.js @@ -3,11 +3,15 @@ var youAre = function(dbot) { return { 'listener': function(data) { - var num = Math.floor(Math.random()*11); - var key = data.message.match(/ is|are ([\d\w\s']*),?\.?and?/); + var num = Math.floor(Math.random()*6); + var key = data.message.match(/(is|are) ([\d\w\s']*),?\.?/); 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]); } },