fix: cache commands at startup

This commit is contained in:
Isaac 2023-03-10 23:46:56 +00:00
parent aeb4450a56
commit 26329453ed
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
2 changed files with 4 additions and 1 deletions

View File

@ -27,7 +27,7 @@ module.exports = class ClaimSlashCommand extends SlashCommand {
const staff = await isStaff(interaction.guild, interaction.member.id); const staff = await isStaff(interaction.guild, interaction.member.id);
const settings = await client.prisma.guild.findUnique({ where: { id: interaction.guild.id } }); const settings = await client.prisma.guild.findUnique({ where: { id: interaction.guild.id } });
const getMessage = client.i18n.getLocale(settings.locale); 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) .filter(c => c.type === 1)
.map(c => `> </${c.name}:${c.id}>: ${c.description}`) .map(c => `> </${c.name}:${c.id}>: ${c.description}`)
.join('\n'); .join('\n');

View File

@ -34,6 +34,9 @@ module.exports = class extends Listener {
.catch(client.log.error); .catch(client.log.error);
} }
// commands are not cached automatically
await client.application.commands.fetch();
// presence/activity // presence/activity
let next = 0; let next = 0;
const setPresence = async () => { const setPresence = async () => {