fix: Cannot read properties of undefined (reading 'burst')

This commit is contained in:
Elysia
2024-09-17 21:20:39 +07:00
parent 0cf8507897
commit 8ae85e4417

View File

@@ -50,14 +50,6 @@ class MessageReaction {
} }
_patch(data) { _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) { if ('burst_colors' in data) {
/** /**
* Hexadecimal colors used for this super reaction * Hexadecimal colors used for this super reaction
@@ -66,6 +58,14 @@ class MessageReaction {
this.burstColors = data.burst_colors; 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) { if ('count_details' in data) {
/** /**
* The reaction count details object contains information about super and normal reaction counts. * The reaction count details object contains information about super and normal reaction counts.
@@ -82,6 +82,8 @@ class MessageReaction {
burst: data.count_details.burst, burst: data.count_details.burst,
normal: data.count_details.normal, normal: data.count_details.normal,
}; };
} else {
this.countDetails ??= { burst: 0, normal: 0 };
} }
} }