get application commands
As part of the js file that registers my commands, I want to get the existing commands before registering the new one. This is for both global and guild commands. There is no connection to the client in this file and I'm using @discordjs/rest.
9 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!djs 1.14.1
node v18.16.1
wait so are you trying to get global commands or both?
both
Routes
is just a wrapper around all the discord api endpoints. If you hover over the applicationsCommands
method, it will show you what endpoint it wraps for each HTTP method. With that you can read the Discord api documentation for those routes and figure what it returns.
Guild Specific: https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands
Global: https://discord.com/developers/docs/interactions/application-commands#get-global-application-commandPurely so that devs can check the permissions are correct
But it shouldn't be up to the devs to set permissions, that's for server admins to do
The default command permissions
new SlashCommandBuilder.setDefaultMemberPermissions()
(If I got the code wrong, it's cause I'm not looking at the code right now)Yeah fair enough that