Empty Array when trying to get Guild Application Commands
I'm trying to retrieve all of the application commands from a discord.js slash command interaction. I have the below code snippet.
// other code aboveconst commands = await interaction.guild?.commands.fetch(); for (const command of commands?.values() as any) { console.log(command.name); }// other code below
// other code aboveconst commands = await interaction.guild?.commands.fetch(); for (const command of commands?.values() as any) { console.log(command.name); }// other code below
However, this returns an empty Collection Map. []
Is there a missing permission for the bot?
I'm using the slash command /setup to execute the function. I'd expect at least 1 object to be returned wit that being the /setup Guild command.