Merge pull request #34 from Mijyuoon/emote-cmd-bugfix-1

Fix a bug in .emote command when the selector number is too large
This commit is contained in:
WatDuhHekBro 2021-04-07 20:26:48 -05:00 committed by GitHub
commit e42e26ae86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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("");