From fed8cb6789b3a39302216773d995ce343196fd30 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Thu, 25 Aug 2011 14:17:51 +0100 Subject: [PATCH] regex better --- modules/youare.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/youare.js b/modules/youare.js index 7f95d96..e795ad8 100644 --- a/modules/youare.js +++ b/modules/youare.js @@ -5,10 +5,14 @@ var youAre = function(dbot) { 'listener': function(data) { var num = Math.floor(Math.random()*11); var key = data.message.match(/ is|are ([\d\w\s']*),?\.?/); + + + + if(num == 1 && key != undefined) { 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]); } },