From 066d210107ab4669d751cb7ed875e05eaa40d231 Mon Sep 17 00:00:00 2001 From: Mijyuoon Date: Thu, 8 Apr 2021 02:41:16 +0300 Subject: [PATCH] Fixed a bug in .emote command when the selector number is too large --- src/commands/utilities/subcommands/emote-utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/utilities/subcommands/emote-utils.ts b/src/commands/utilities/subcommands/emote-utils.ts index 16ca2eb..0fdbf9c 100644 --- a/src/commands/utilities/subcommands/emote-utils.ts +++ b/src/commands/utilities/subcommands/emote-utils.ts @@ -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(""); \ No newline at end of file +export const processEmoteQueryFormatted = (query: string[]): string => processEmoteQuery(query, true).join("");