Skip to content

Commit

Permalink
fix: Cannot read properties of undefined (reading 'burst')
Browse files Browse the repository at this point in the history
  • Loading branch information
aiko-chan-ai committed Sep 17, 2024
1 parent 0cf8507 commit 8ae85e4
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/structures/MessageReaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ class MessageReaction {
}

_patch(data) {
if ('count' in data) {
/**
* The number of people that have given the same reaction
* @type {?number}
*/
this.count ??= data.count;
}

if ('burst_colors' in data) {
/**
* Hexadecimal colors used for this super reaction
Expand All @@ -66,6 +58,14 @@ class MessageReaction {
this.burstColors = data.burst_colors;
}

if ('count' in data) {
/**
* The number of people that have given the same reaction
* @type {?number}
*/
this.count ??= data.count;
}

if ('count_details' in data) {
/**
* The reaction count details object contains information about super and normal reaction counts.
Expand All @@ -82,6 +82,8 @@ class MessageReaction {
burst: data.count_details.burst,
normal: data.count_details.normal,
};
} else {
this.countDetails ??= { burst: 0, normal: 0 };
}
}

Expand Down

0 comments on commit 8ae85e4

Please sign in to comment.