Skip to content
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

feat: super reactions #9336

Merged
merged 11 commits into from
Aug 27, 2024
26 changes: 26 additions & 0 deletions packages/discord.js/src/structures/MessageReaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,39 @@ class MessageReaction {
}

_patch(data) {
if ('burst_colors' in data) {
/**
* HEX colors used for super reaction
Jiralite marked this conversation as resolved.
Show resolved Hide resolved
* @type {string[]}
jaw0r3k marked this conversation as resolved.
Show resolved Hide resolved
*/
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.
* @typedef {Object} ReactionCountDetailsData
* @property {number} burst Count of super reaction
Jiralite marked this conversation as resolved.
Show resolved Hide resolved
* @property {number} normal Count of normal reaction
Jiralite marked this conversation as resolved.
Show resolved Hide resolved
*/

/**
* The reaction count details object contains information about super and normal reaction counts.
* @type {?ReactionCountDetailsData}
Jiralite marked this conversation as resolved.
Show resolved Hide resolved
*/
this.countDetails = {
burst: data.count_details.burst,
normal: data.count_details.normal,
};
}
}

/**
Expand Down
7 changes: 7 additions & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2180,8 +2180,10 @@ export class MessageReaction {
private constructor(client: Client<true>, data: RawMessageReactionData, message: Message);
private _emoji: GuildEmoji | ReactionEmoji;

public burstColors: string[];
public readonly client: Client<true>;
public count: number;
public countDetails: ReactionCountDetailsData;
public get emoji(): GuildEmoji | ReactionEmoji;
public me: boolean;
public message: Message | PartialMessage;
Expand Down Expand Up @@ -5906,6 +5908,11 @@ export interface MessageSelectOption {
value: string;
}

export interface ReactionCountDetailsData {
burst: number;
normal: number;
}

export interface SelectMenuComponentOptionData {
default?: boolean;
description?: string;
Expand Down