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:
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