loldonut
loldonut

Reputation: 64

discord.js - How do I delete a specific slash command?

How do I delete a specific guild/global slash command?

I tried searching on google how, but I'm just confused about the command id thingy.

Upvotes: 2

Views: 4453

Answers (1)

MrMythical
MrMythical

Reputation: 9041

You can use ApplicationCommand.delete().

This will delete a global command by name:

client.application.commands.cache.find(c => c.name === 'cmd_name_here').delete()
//make sure that client is an instance of Client

And this will delete a guild command by name:

guild.commands.cache.find(c => c.name === 'cmd_name_here').delete()
//make sure that guild is an instance of Guild

This only works on v13 however. On v12 you need to make an API request

Upvotes: 1

Related Questions