forked from GitHub/dbot
After actually learning how valMatch works, this motherfucker is ready to roll.
This commit is contained in:
parent
2f9af449ec
commit
ad6b354daf
@ -36,14 +36,14 @@ var spelling = function(dbot) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'listener': function(data, params) {
|
'listener': function(data, params) {
|
||||||
var q = data.message.valMatch(/^(?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 2);
|
var q = data.message.valMatch(/^(?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 3);
|
||||||
var otherQ = 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) {
|
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);
|
dbot.say(data.channel, e.correcter + ' meant: ' + e.fix);
|
||||||
});
|
});
|
||||||
} else if(otherQ) {
|
} 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);
|
dbot.say(data.channel, e.correcter + ' thinks ' + e.candidate + ' meant: ' + e.fix);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user