fix(MessageReaction): Address undefined burst properties
#10597
Merged
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.
Please describe the changes this PR makes and why it should be merged:
When receiving a non-burst reaction over the gateway, we get this (example) payload:
This data is shoved into the cache here:
discord.js/packages/discord.js/src/client/actions/MessageReactionAdd.js
Lines 42 to 47 in c45d912
burst_colorsis not here, but we make sure the property exists. This means here, it's set toundefined:discord.js/packages/discord.js/src/structures/MessageReaction.js
Lines 55 to 61 in c45d912
me_burstis also not here, which means this isundefinedtoo:discord.js/packages/discord.js/src/structures/MessageReaction.js
Line 39 in c45d912
Interestingly, there does not seem to be a way for bots to burst react, so doing
Boolean(data.me_burst)should be enough. Forburst_colors... since that is always present, I've added an array check. If it's not an array, then it's likely missing and should be left alone.Tested also with no partials and
[Partials.Channel, Partials.GuildMember, Partials.GuildScheduledEvent, Partials.Message, Partials.Reaction, Partials.ThreadMember, Partials.User].Status and versioning classification: