From 26329453edded63b92690a5c10e573bf241559e6 Mon Sep 17 00:00:00 2001 From: Isaac Date: Fri, 10 Mar 2023 23:46:56 +0000 Subject: [PATCH] fix: cache commands at startup --- src/commands/slash/help.js | 2 +- src/listeners/client/ready.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands/slash/help.js b/src/commands/slash/help.js index cd41fbb..2d5f13a 100644 --- a/src/commands/slash/help.js +++ b/src/commands/slash/help.js @@ -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.description}`) .join('\n'); diff --git a/src/listeners/client/ready.js b/src/listeners/client/ready.js index e892210..9e78265 100644 --- a/src/listeners/client/ready.js +++ b/src/listeners/client/ready.js @@ -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 () => {