avoid bulk overwriting global commands#2115
Merged
akiraveliara merged 6 commits intoOct 24, 2024
Merged
Conversation
Plerx2493
approved these changes
Oct 14, 2024
OoLunar
approved these changes
Oct 19, 2024
OoLunar
left a comment
Contributor
There was a problem hiding this comment.
I see the following code snippet reused a LOT:
if ((a is null || a.Count == 0) && (b is null || b.Count == 0))
{
return true;
}
if (a is null || b is null)
{
return false;
}
if (a.Count != b.Count)
{
return false;
}Can we extract this to an interface-based method?
Generally LGTM at a glance, have not tested or used anything.
Member
Author
|
a note to the pattern matching suggestions from @OoLunar : pattern matching is only possible when matching against constants. |
Member
|
0 and null are both constants - at the very least I would recommend merging some of those |
VelvetToroyashi
approved these changes
Oct 24, 2024
Voroniyx
reviewed
Oct 24, 2024
| else | ||
| { | ||
| await this.extension.Client.DeleteGuildApplicationCommandAsync(this.extension.DebugGuildId, command.Id); | ||
| } |
There was a problem hiding this comment.
Code stylistically, should be the same as in CreateGlobalCommandAsync, because except for the different method call it is the same. So either an if-else or ?: in both
Member
Author
There was a problem hiding this comment.
can't be, because this one doesn't return a value it can't be a ternary
Instellate
pushed a commit
that referenced
this pull request
Nov 4, 2024
* preliminary mitigation of the issue * rewire everything to avoid global bulk updates * formatting artifact * treat GuildInstall as default * some pattern matching, as a treat
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

avoids bulk overwriting global commands, and instead fetches all commands and only updates/creates/deletes whatever necessary
also adds an option to restore the old behaviour in case this causes issues for users. i'm unsure on keeping that option in the future, but for now, while this hotfix is not battle-tested, it's probably a good idea to have
autocomplete and chat input commands are tested and work.