From ad6b354dafc4d8c6bacb894037943a99b54b3b44 Mon Sep 17 00:00:00 2001 From: Psychedelic Squid Date: Tue, 6 Mar 2012 16:34:18 +0000 Subject: [PATCH] After actually learning how valMatch works, this motherfucker is ready to roll. --- modules/spelling.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/spelling.js b/modules/spelling.js index ea0f581..3dc85e1 100644 --- a/modules/spelling.js +++ b/modules/spelling.js @@ -36,14 +36,14 @@ var spelling = function(dbot) { return { 'listener': function(data, params) { - var q = data.message.valMatch(/^(?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 2); - var otherQ = data.message.valMatch(/^([\d\w\s]*): \*\*?([\d\w\s']*)$/, 3); + var q = data.message.valMatch(/^(?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 3); + var otherQ = data.message.valMatch(/^([\d\w\s]*): (?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 4); if(q) { - correct(data, q[1], data.user, function (e) { + correct(data, q[1] || q[2], data.user, function (e) { dbot.say(data.channel, e.correcter + ' meant: ' + e.fix); }); } else if(otherQ) { - correct(data, otherQ[2], otherQ[1], function (e) { + correct(data, otherQ[2] || otherQ[3], otherQ[1], function (e) { dbot.say(data.channel, e.correcter + ' thinks ' + e.candidate + ' meant: ' + e.fix); }); } else {