Fixed a bug in .emote command when the selector number is too large

This commit is contained in:
Mijyuoon 2021-04-08 02:41:16 +03:00
parent 053b835e89
commit 066d210107
1 changed files with 2 additions and 2 deletions

View File

@ -101,7 +101,7 @@ function processEmoteQuery(query: string[], isFormatted: boolean): string[] {
// Find all similar emote candidates within certian threshold and select Nth top one according to the selector.
const similarEmotes = searchSimilarEmotes(emote);
if (similarEmotes.length > 0) {
selector = Math.min(selector, similarEmotes.length);
selector = Math.min(selector, similarEmotes.length - 1);
return similarEmotes[selector].toString();
}
@ -111,4 +111,4 @@ function processEmoteQuery(query: string[], isFormatted: boolean): string[] {
}
export const processEmoteQueryArray = (query: string[]): string[] => processEmoteQuery(query, false);
export const processEmoteQueryFormatted = (query: string[]): string => processEmoteQuery(query, true).join("");
export const processEmoteQueryFormatted = (query: string[]): string => processEmoteQuery(query, true).join("");