3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 19:52:36 +01:00

do that properly

This commit is contained in:
Luke Slater 2012-01-09 14:53:48 +00:00
parent 007540bead
commit c2d2e0342e

View File

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