-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(ApplicationCommand): remove false negatives in equals #10596
base: main
Are you sure you want to change the base?
fix(ApplicationCommand): remove false negatives in equals #10596
Conversation
This fixes a bug where having a local command that doesn't declare integrationTypes explicitly would cause it to not be equal to the command returned by Discord as they send a default value of [ 0 ]
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
Since I've seen semver:major PRs starting to be merged I'm not sure if this could fit into a v14.16.4 or a v14.17.0 but it would be nice if it could! |
We are currently backporting pull requests if possible to v14. |
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.
According to documentation, 0 is not default.
According to this discord/discord-api-docs#7108 (comment) it's 0 for only older commands
Upon testing, it depends on installation contexts set by users on dev portal when using bulk overwrite route, so it's not just one thing that's returned by the api.
In any case, this is not the correct approach. I'm not sure what would be an appropriate solution, but imo, it should be left as is
It should absolutely not be left as it is, as a local command should always be equal to the version sent by Discord, and this method is often used to check for changes locally and update them with Discord accordingly. I believe it is safe to assume that apps made with discord.js will default to guild installs (I'm not sure if a user install can even be made with discord.js) but I'd be happy to change the approach if the maintainers think otherwise |
Also upon further investigation, my bot has no integrationTypesConfig (it's set to null), so I think it would be safe to assume that the default is |
D.js doesn't decides default value, it's discord. And it varies depending on situation
So if a person has both for installation contexts, the default value will be |
Also you are thinking only for yourself, not everyone applies to your situation |
Hmm, this definitely highlights an issue (and an oddly inconsistent behavior in Discord's own API, re: POST/PUT) that can't be fixed just by slapping in a |
Yeah that was my suggestion, but what should we do when that config is also null like the case I described above? |
Applied this solution, let me know if this is better |
Please describe the changes this PR makes and why it should be merged:
This fixes a bug where having a local command that doesn't declare integrationTypes explicitly would cause it to not be equal to the command returned by Discord as they send a default value of
[ 0 ]
. In order to fix this, it defaults the value tothis.client.application.integrationTypesConfig?.keys()
or[ApplicationIntegrationType.GuildInstall]
if that's nullStatus and versioning classification: