Allow finding characters in slash commands by exact PNG name

This commit is contained in:
Cohee 2024-02-16 20:24:47 +02:00
parent 106cdf3aed
commit a8cd6c9fe7
1 changed files with 6 additions and 0 deletions

View File

@ -1119,6 +1119,12 @@ function findCharacterIndex(name) {
(a, b) => a.includes(b), (a, b) => a.includes(b),
]; ];
const exactAvatarMatch = characters.findIndex(x => x.avatar === name);
if (exactAvatarMatch !== -1) {
return exactAvatarMatch;
}
for (const matchType of matchTypes) { for (const matchType of matchTypes) {
const index = characters.findIndex(x => matchType(x.name.toLowerCase(), name.toLowerCase())); const index = characters.findIndex(x => matchType(x.name.toLowerCase(), name.toLowerCase()));
if (index !== -1) { if (index !== -1) {