modules.move: fix !move ignoring the last letter of the category name
parent
f13f2eee2d
commit
d6793d5c12
|
@ -27,13 +27,11 @@ module.exports = bot => {
|
||||||
const containsRankings = categories.map(cat => {
|
const containsRankings = categories.map(cat => {
|
||||||
const normalizedCatName = transliterate.slugify(cat.name);
|
const normalizedCatName = transliterate.slugify(cat.name);
|
||||||
|
|
||||||
let i;
|
let i = 0;
|
||||||
for (i = 1; i < normalizedSearchStr.length; i++) {
|
do {
|
||||||
if (! normalizedCatName.includes(normalizedSearchStr.slice(0, i))) {
|
if (! normalizedCatName.includes(normalizedSearchStr.slice(0, i + 1))) break;
|
||||||
i--;
|
i++;
|
||||||
break;
|
} while (i < normalizedSearchStr.length);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [cat, i];
|
return [cat, i];
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue