Skip to content

Commit bda3128

Browse files
feat: Emit reaction type on gateway events (#10598)
feat: emit reaction type Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 76968b4 commit bda3128

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

packages/discord.js/src/client/actions/MessageReactionAdd.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class MessageReactionAdd extends Action {
5151
/**
5252
* Provides additional information about altered reaction
5353
* @typedef {Object} MessageReactionEventDetails
54+
* @property {ReactionType} type The type of the reaction
5455
* @property {boolean} burst Determines whether a super reaction was used
5556
*/
5657
/**
@@ -60,7 +61,7 @@ class MessageReactionAdd extends Action {
6061
* @param {User} user The user that applied the guild or reaction emoji
6162
* @param {MessageReactionEventDetails} details Details of adding the reaction
6263
*/
63-
this.client.emit(Events.MessageReactionAdd, reaction, user, { burst: data.burst });
64+
this.client.emit(Events.MessageReactionAdd, reaction, user, { type: data.type, burst: data.burst });
6465

6566
return { message, reaction, user };
6667
}

packages/discord.js/src/client/actions/MessageReactionRemove.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MessageReactionRemove extends Action {
4141
* @param {User} user The user whose emoji or reaction emoji was removed
4242
* @param {MessageReactionEventDetails} details Details of removing the reaction
4343
*/
44-
this.client.emit(Events.MessageReactionRemove, reaction, user, { burst: data.burst });
44+
this.client.emit(Events.MessageReactionRemove, reaction, user, { type: data.type, burst: data.burst });
4545

4646
return { message, reaction, user };
4747
}

packages/discord.js/src/util/APITypes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,11 @@
510510
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/PollLayoutType}
511511
*/
512512

513+
/**
514+
* @external ReactionType
515+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ReactionType}
516+
*/
517+
513518
/**
514519
* @external RoleFlags
515520
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/RoleFlags}

packages/discord.js/typings/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,6 +2490,7 @@ export class MessageReaction {
24902490
}
24912491

24922492
export interface MessageReactionEventDetails {
2493+
type: ReactionType;
24932494
burst: boolean;
24942495
}
24952496

0 commit comments

Comments
 (0)