Function to grab all registered global slash commands #3925
Replies: 2 comments 6 replies
-
I don't know how DiscordPY works but for DiscordJS you can easily fetch all commands for a guild when you don't specify a command id. Also to come to the topic of guild commands you shouldn't read them on startup but store them upon creation, they only change when you alter them, they are still registered when your bot is offline. So practical use:
|
Beta Was this translation helpful? Give feedback.
-
Well apparently it's not that API heavy because Discord itself sends a separate Guild_create event for every guild as it becomes "available" while you're booting up your bot, so it's okay to request per guild, you should do it in the guild_create event on your bot startup. In addition to creating missing commands I suggest you also implement an equals method for commands to compare if your local copy is identical to the uploaded copy, if not do an update. |
Beta Was this translation helpful? Give feedback.
-
I think it should be possible to grab all the slash commands located in guilds(for your bot), in one api request, so on libraries like discord.py, or discord.js you don't need to readd the command every time the bot starts up, instead you would be able to add it temporarily in your cache, so the commands, get added if they haven't been. Basically it just makes it easier to see what slash commands you registered in guilds, and it doesn't take a ton of api requests, if this can't be added, then why not?
(yes I am aware that slash commands can be grabbed but only the global ones.)
Beta Was this translation helpful? Give feedback.
All reactions