Registering multiple commands for many guilds
I am trying to register 7 premium commands only for 1 guild and 25 public commands for all the others (including the premium guild).
I tried 2 approaches -
- Using the GuildApplicationCommandManager Class
- Using REST API
Using the first method, I usually get rate limited, and for my premium server, the 25 public commands are never stored to cache and on every bot reload, only 7 premium commands remain. I switched to this method because I was getting duplicate commands using the
rest.put()
method.
I have included all the necessary files along with the message.
The flow goes as such -
- As soon as the bot is ready, first the 01registerSlashCommands.js
runs followed by 02registerPublicSlashCommands
.
- The utility files help to return local
(in the project files) and the application
(GuildApplicationCommandManager.fetch())
commands.
Should I switch back to the REST approach or is there a way out of this?
Note: Please ignore the return
statement in the 01registerSlashCommands.js
file18 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!you should preferably use REST yes, you dont need to deploy every time your bot starts
Alright I'll remove the files and send over in sourcebin
because as far as i can see, your approach would get you ratelimited in an instant indeed
use REST, and use a PUT call
Well not in an instant, because most of the commands are there in cache.
no need to delete your commands
Alright I'll try and get back
PUT overrides with what you pass
gotcha
so pass the entire array, and run it only when you add or edit command data
and for the already duplicate commands I need to use the DELETE request correct?
just PUT an empty array to that route
use global commands for your 25 guilds
you're insane
and deploy your premium commands to that guild only
only your premium commands
Alright mate, thank you so much!
they should show both global and guild commands
👍