| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
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.
Sorry, something went wrong.
|
a note to the pattern matching suggestions from @OoLunar : pattern matching is only possible when matching against constants. |
Sorry, something went wrong.
|
0 and null are both constants - at the very least I would recommend merging some of those |
Sorry, something went wrong.
| 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
Sorry, something went wrong.
There was a problem hiding this comment.
can't be, because this one doesn't return a value it can't be a ternary
Sorry, something went wrong.
There was a problem hiding this comment.
my bad then, overlooked it sorry
Sorry, something went wrong.
* preliminary mitigation of the issue * rewire everything to avoid global bulk updates * formatting artifact * treat GuildInstall as default * some pattern matching, as a treat
| Back | FazBrowse Home | New Git URL |
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.