aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorCory J Reid <[email protected]>2023-07-23 17:06:35 -0600
committerGitHub <[email protected]>2023-07-23 18:06:35 -0500
commit3998b063866f234e370ebd6cf14a85d50c7242ea (patch)
tree75b1474e8ac57d83a01686bf172d4e5024d0dd63 /src/commands
parent6b6066c06a884c374876531eb31852c80fba8822 (diff)
downloadmuse-3998b063866f234e370ebd6cf14a85d50c7242ea.tar.xz
muse-3998b063866f234e370ebd6cf14a85d50c7242ea.zip
Autocomplete Suggestion Improvements for Favorites Use Command (#956)
Co-authored-by: Max Isom <[email protected]>
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/favorites.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/commands/favorites.ts b/src/commands/favorites.ts
index 303dc22..d43a92c 100644
--- a/src/commands/favorites.ts
+++ b/src/commands/favorites.ts
@@ -89,14 +89,16 @@ export default class implements Command {
},
});
- let results = query === '' ? favorites : favorites.filter(f => f.name.startsWith(query));
+ let results = query === '' ? favorites : favorites.filter(f => f.name.toLowerCase().startsWith(query.toLowerCase()));
if (subcommand === 'remove') {
// Only show favorites that user is allowed to remove
results = interaction.member?.user.id === interaction.guild?.ownerId ? results : results.filter(r => r.authorId === interaction.member!.user.id);
}
- await interaction.respond(results.map(r => ({
+ // Limit results to 25 maximum per Discord limits
+ const trimmed = results.length > 25 ? results.slice(0, 25) : results;
+ await interaction.respond(trimmed.map(r => ({
name: r.name,
value: r.name,
})));