Enderhoang
Enderhoang

Reputation: 51

Fetching and deleting all slash commands in discord.js v13

I followed this part in the discordjs docs to fetch all commands. But that way it only shows the commands count and doesnt tell me the id of the commands. How do I fetch all the commands and delete all of them? This is the code in that page. It didnt work yet so I dont have a delete code currently

guild.commands.fetch()
  .then(commands => console.log(`Fetched ${commands.size} commands`))
  .catch(console.error);

Upvotes: 2

Views: 3532

Answers (1)

iamkneel
iamkneel

Reputation: 1508

If you want to delete all your commands, you can do this:

guild.commands.set([])

What that does is set your command list for that guild to an empty array, essentially "deleting" all of your commands for the guild.

Upvotes: 3

Related Questions