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 file
18 Replies
d.js toolkit
d.js toolkit22h ago
- 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!
d.js docs
d.js docs22h ago
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.
treble/luna
treble/luna22h ago
you should preferably use REST yes, you dont need to deploy every time your bot starts
MartialAssault
MartialAssaultOP22h ago
Alright I'll remove the files and send over in sourcebin
treble/luna
treble/luna22h ago
because as far as i can see, your approach would get you ratelimited in an instant indeed use REST, and use a PUT call
MartialAssault
MartialAssaultOP22h ago
Well not in an instant, because most of the commands are there in cache.
treble/luna
treble/luna22h ago
no need to delete your commands
MartialAssault
MartialAssaultOP22h ago
Alright I'll try and get back
treble/luna
treble/luna22h ago
PUT overrides with what you pass
MartialAssault
MartialAssaultOP22h ago
gotcha
treble/luna
treble/luna22h ago
so pass the entire array, and run it only when you add or edit command data
MartialAssault
MartialAssaultOP22h ago
and for the already duplicate commands I need to use the DELETE request correct?
treble/luna
treble/luna22h ago
just PUT an empty array to that route use global commands for your 25 guilds
MartialAssault
MartialAssaultOP22h ago
you're insane
treble/luna
treble/luna22h ago
and deploy your premium commands to that guild only only your premium commands
MartialAssault
MartialAssaultOP22h ago
Alright mate, thank you so much!
treble/luna
treble/luna22h ago
they should show both global and guild commands
MartialAssault
MartialAssaultOP22h ago
👍

Did you find this page helpful?