mirror of
https://github.com/reality/dbot.git
synced 2024-11-24 04:49:25 +01:00
do that properly
This commit is contained in:
parent
007540bead
commit
c2d2e0342e
@ -10,14 +10,14 @@ var spelling = function(dbot) {
|
||||
for(var i=0;i<candidates.length;i++) {
|
||||
var distance = String.prototype.distance(correction, candidates[i]);
|
||||
if(distance < winnerDistance) {
|
||||
winner = candidates[i];
|
||||
winner = i;
|
||||
winnerDistance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
if(winnerDistance < 7) {
|
||||
if(winner !== correction) {
|
||||
candidates[i] = correction;
|
||||
candidates[winner] = correction;
|
||||
var fix = candidates.join(' ');
|
||||
last[data.channel][candidate] = fix;
|
||||
if (/^.ACTION/.test(fix)) {
|
||||
|
Loading…
Reference in New Issue
Block a user