feat: Emit reaction type on gateway events

#10598 djs
This commit is contained in:
Elysia
2025-01-21 01:29:18 +07:00
parent 002b1d8fc0
commit 599e53abe6
7 changed files with 25 additions and 18 deletions

View File

@@ -49,6 +49,7 @@ class MessageReactionAdd extends Action {
/** /**
* Provides additional information about altered reaction * Provides additional information about altered reaction
* @typedef {Object} MessageReactionEventDetails * @typedef {Object} MessageReactionEventDetails
* @property {ReactionType} type The type of the reaction
* @property {boolean} burst Determines whether a super reaction was used * @property {boolean} burst Determines whether a super reaction was used
*/ */
/** /**
@@ -58,7 +59,7 @@ class MessageReactionAdd extends Action {
* @param {User} user The user that applied the guild or reaction emoji * @param {User} user The user that applied the guild or reaction emoji
* @param {MessageReactionEventDetails} details Details of adding the reaction * @param {MessageReactionEventDetails} details Details of adding the reaction
*/ */
this.client.emit(Events.MESSAGE_REACTION_ADD, reaction, user, { burst: data.burst }); this.client.emit(Events.MESSAGE_REACTION_ADD, reaction, user, { type: data.type, burst: data.burst });
return { message, reaction, user }; return { message, reaction, user };
} }

View File

@@ -41,7 +41,7 @@ class MessageReactionRemove extends Action {
* @param {User} user The user whose emoji or reaction emoji was removed * @param {User} user The user whose emoji or reaction emoji was removed
* @param {MessageReactionEventDetails} details Details of removing the reaction * @param {MessageReactionEventDetails} details Details of removing the reaction
*/ */
this.client.emit(Events.MESSAGE_REACTION_REMOVE, reaction, user, { burst: data.burst }); this.client.emit(Events.MESSAGE_REACTION_REMOVE, reaction, user, { type: data.type, burst: data.burst });
return { message, reaction, user }; return { message, reaction, user };
} }

View File

@@ -13,11 +13,6 @@ const Util = require('../util/Util');
* @property {MessageActivityType} type Type of activity sent * @property {MessageActivityType} type Type of activity sent
*/ */
/**
* @external MessageActivityType
* @see {@link https://discord-api-types.dev/api/discord-api-types-v9/enum/MessageActivityType}
*/
/** /**
* The status of this presence: * The status of this presence:
* * **`online`** - user is online * * **`online`** - user is online

View File

@@ -3,11 +3,6 @@
const Base = require('./Base'); const Base = require('./Base');
const { MembershipStates } = require('../util/Constants'); const { MembershipStates } = require('../util/Constants');
/**
* @external TeamMemberRole
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TeamMemberRole}
*/
/** /**
* Represents a Client OAuth2 Application Team Member. * Represents a Client OAuth2 Application Team Member.
* @extends {Base} * @extends {Base}

View File

@@ -77,11 +77,6 @@ class TextBasedChannel {
* @property {PollLayoutType} [layoutType] The layout type for the poll * @property {PollLayoutType} [layoutType] The layout type for the poll
*/ */
/**
* @external PollLayoutType
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/PollLayoutType}
*/
/** /**
* Base options provided when sending. * Base options provided when sending.
* @typedef {Object} BaseMessageOptions * @typedef {Object} BaseMessageOptions

19
src/util/APITypes.js Normal file
View File

@@ -0,0 +1,19 @@
/**
* @external MessageActivityType
* @see {@link https://discord-api-types.dev/api/discord-api-types-v9/enum/MessageActivityType}
*/
/**
* @external PollLayoutType
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/PollLayoutType}
*/
/**
* @external ReactionType
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ReactionType}
*/
/**
* @external TeamMemberRole
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TeamMemberRole}
*/

4
typings/index.d.ts vendored
View File

@@ -60,7 +60,8 @@ import {
GuildScheduledEventRecurrenceRuleWeekday, GuildScheduledEventRecurrenceRuleWeekday,
GuildScheduledEventRecurrenceRuleMonth, GuildScheduledEventRecurrenceRuleMonth,
GuildScheduledEventRecurrenceRuleFrequency, GuildScheduledEventRecurrenceRuleFrequency,
APIChatInputApplicationCommandInteractionData, APIContextMenuInteractionData APIChatInputApplicationCommandInteractionData, APIContextMenuInteractionData,
ReactionType
} from 'discord-api-types/v10'; } from 'discord-api-types/v10';
import { ChildProcess, ChildProcessWithoutNullStreams } from 'node:child_process'; import { ChildProcess, ChildProcessWithoutNullStreams } from 'node:child_process';
import { EventEmitter } from 'node:events'; import { EventEmitter } from 'node:events';
@@ -2553,6 +2554,7 @@ export interface ReactionCountDetailsData {
normal: number; normal: number;
} }
export interface MessageReactionEventDetails { export interface MessageReactionEventDetails {
type: ReactionType;
burst: boolean; burst: boolean;
} }