After actually learning how valMatch works, this motherfucker is ready to roll.

This commit is contained in:
Psychedelic Squid 2012-03-06 16:34:18 +00:00
parent 2f9af449ec
commit ad6b354daf

View File

@ -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 {