From a8cd6c9fe78837aab56dec2ebf8182b4c2daec58 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 16 Feb 2024 20:24:47 +0200 Subject: [PATCH] Allow finding characters in slash commands by exact PNG name --- public/scripts/slash-commands.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index fe8408b06..a6b3df533 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -1119,6 +1119,12 @@ function findCharacterIndex(name) { (a, b) => a.includes(b), ]; + const exactAvatarMatch = characters.findIndex(x => x.avatar === name); + + if (exactAvatarMatch !== -1) { + return exactAvatarMatch; + } + for (const matchType of matchTypes) { const index = characters.findIndex(x => matchType(x.name.toLowerCase(), name.toLowerCase())); if (index !== -1) {