Skip to content

Commit

Permalink
fix: cache commands at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Mar 10, 2023
1 parent aeb4450 commit 2632945
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/slash/help.js
Expand Up @@ -27,7 +27,7 @@ module.exports = class ClaimSlashCommand extends SlashCommand {
const staff = await isStaff(interaction.guild, interaction.member.id);
const settings = await client.prisma.guild.findUnique({ where: { id: interaction.guild.id } });
const getMessage = client.i18n.getLocale(settings.locale);
const commands = (await client.application.commands.fetch())
const commands = client.application.commands.cache
.filter(c => c.type === 1)
.map(c => `> </${c.name}:${c.id}>: ${c.description}`)
.join('\n');
Expand Down
3 changes: 3 additions & 0 deletions src/listeners/client/ready.js
Expand Up @@ -34,6 +34,9 @@ module.exports = class extends Listener {
.catch(client.log.error);
}

// commands are not cached automatically
await client.application.commands.fetch();

// presence/activity
let next = 0;
const setPresence = async () => {
Expand Down

0 comments on commit 2632945

Please sign in to comment.