-1

how to delete all slash commands using discord.js? I'm using 13.5.0 version

bot.on('interactionCreate', interaction => {
          if (!interaction.isCommand()) return;
          bot.api.applications(bot.user.id).commands(interaction.commandId).delete();
});

I tried to do this, but it's just gives me error: Uncaught DiscordAPIError: Unknown application command

VuzZ
  • 13
  • 1
  • 3
  • [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask): _"Write a title that **summarizes the specific problem**"_ – Andreas Jan 22 '22 at 12:13

1 Answers1

1

Setting slash commands takes up to an hour if done globally, so use the second param, guildid, to delete the slash commands of your bot for a testing server when testing. remove the second param when you want the slash commands to appear globally.

The code would be like so:

bot.application.commands.set([], <GuildId>);
wyndmill
  • 66
  • 6