SlinkyPotato
SlinkyPotato
DIAdiscord.js - Imagine an app
Created by SlinkyPotato on 10/27/2023 in #djs-questions
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 above
const commands = await interaction.guild?.commands.fetch();
for (const command of commands?.values() as any) {
console.log(command.name);
}
// other code below
// other code above
const 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.
8 replies