-
-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global commands will be sent to Discord to register only if it differs from the existing global commands from Discord's servers #634
Merged
Lulalaby
merged 7 commits into
Pycord-Development:master
from
PenguinDevs:global-slash-commands
Dec 26, 2021
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VincentRPS
previously approved these changes
Dec 24, 2021
BobDotCom
requested changes
Dec 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the suggestions I made on this. In addition, I will work on further improving command registration soon. Partially completes #433.
BobDotCom
added
good first issue
Good for newcomers
priority: medium
Medium Priority
status: in progress
Work in Progess
labels
Dec 24, 2021
print() -> none unnecessary if len() > 0 because loop will run anyways Pycord-Development#634 (review) Co-Authored-By: BobDotCom <[email protected]>
…s/pycord into global-slash-commands
BobDotCom
approved these changes
Dec 26, 2021
Lulalaby
approved these changes
Dec 26, 2021
7 tasks
VincentRPS
pushed a commit
to VincentRPS/pycord
that referenced
this pull request
Jan 22, 2022
print() -> none unnecessary if len() > 0 because loop will run anyways Pycord-Development#634 (review) Co-Authored-By: BobDotCom <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
good first issue
Good for newcomers
priority: medium
Medium Priority
status: in progress
Work in Progess
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The method
.register_commands()
in the bot.py file of the current version of Pycord always deploy the global slash commands every time the bot is started. This method is not ideal because it is telling Discord to roll out the commands every single time the bot is started when the global slash commands may not differ from the previous deployment of the commands. This method leads therefore leads to theInvalid interaction application command
that will occur every single start of the bot for up to one hour. During this period when all global slash commands in the bot will always returnInvalid interaction application command
rendering it to be unusable by the user.This pull aims to fix the
Invalid interaction application command
by using the.register_commands()
method to only deploy the global slash commands using thehttp.bulk_upsert_global_commands()
method only if the global commands stored in Discord fromhttp.get_global_commands()
has certain attributes that differs from the global commands (no guild_ids) in.pending_application_commands
. This means that if the global commands are not changed in the bot's code by comparing to the last deployment of global commands to Discord, users will not receive theInvalid interaction application command
.Invalid interaction application command
will only occur if the global commands have changed when the bot is started and Discord is still attempting to roll out the global commands taking up to an hour using the new deployment of global commands.Checklist
type: ignore
comments were used, a comment is also left explaining why