Ability to differentiate between global-scope and guild-scoped slash commands #3337
Replies: 1 comment
-
The command ID is already necessary for all the maintenance that needs to be done on commands such as permission updates, deletion, etc. Don't let your code guess what command was used based on the name, just setup a lookup table by the command IDs to execute the precisely correct command body for a given interaction. When you upload your commands wait for Discord's response to get their command IDs. At this step your code knows whether or not they are global or guild commands because the API endpoints they go to are different. Use this opportunity to tag your commands as guild or global so when you fetch them by ID your code knows exactly if it's a guild or global command. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Currently, there is no way to differentiate between two slash commands inside of a guild if they have the same name aside from storing the slash command's
id
. The only thing you get with anINTERACTION_CREATE
which will identify the command isdata: {id, name, ?options}
.Why This is Needed
So we don't have to store the slash command's
id
to see if it's the global command or the guild command.Alternatives Considered
Maybe adding the
guild_id
to thedata
payload so we know it's guild-scoped, or evenis_global: false
Beta Was this translation helpful? Give feedback.
All reactions