JScanvaser
JScanvaser

Reputation: 1

How do i delete a slash command from discord.js client

I added two slash commands accidently and I tried to delete it by

guild.commands.delete("Id")

but it requires ID and I couldn't get Id of an client command

Upvotes: 0

Views: 1104

Answers (1)

denvermullets
denvermullets

Reputation: 21

i think something like this solution would work for you: https://stackoverflow.com/a/69171716/13269697

guild.commands.delete('123456789012345678')

and you get your command id via something like this in the replies:

guild.commands.cache.forEach((value, key) => { 
  // key is then your id or do value.id
  console.log(value.id)
}) 

ApplicationCommandManager

also, make sure you did remove the duplicate in your code if you didn't already or it'll just re-appear the next time you push commands

edit:

you could just reset all of the commands and then repush them if that's easier. then remove this line so it doesn't always reset.

client.application.commands.set([])

Upvotes: 1

Related Questions