Update MessageReaction docs

This commit is contained in:
Nicolás Serna 2022-07-20 22:12:27 -03:00
parent 38416f4d32
commit e2d7993182

View File

@ -3,6 +3,10 @@ import type { DiscordMemberWithUser, DiscordMessageReactionAdd, DiscordReaction
import Emoji from './Emoji.ts'; import Emoji from './Emoji.ts';
import Member from './Member.ts'; import Member from './Member.ts';
/**
* Represents when a new reaction was added to a message.
* @link https://discord.com/developers/docs/topics/gateway#message-reaction-add
* */
export interface MessageReactionAdd { export interface MessageReactionAdd {
userId: string; userId: string;
channelId: string; channelId: string;
@ -12,13 +16,39 @@ export interface MessageReactionAdd {
emoji: Partial<Emoji>; emoji: Partial<Emoji>;
} }
/**
* Represents when a reaction was removed from a message.
* Equal to MessageReactionAdd but without 'member' property.
* @see {@link MessageReactionAdd}
* @link https://discord.com/developers/docs/topics/gateway#message-reaction-remove-message-reaction-remove-event-fields
*/
export type MessageReactionRemove = Omit<MessageReactionAdd, 'member'>; export type MessageReactionRemove = Omit<MessageReactionAdd, 'member'>;
/**
* Represents when all reactions were removed from a message.
* Equals to MessageReactionAdd but with 'channelId', 'messageId' and 'guildId' properties guaranteed.
* @see {@link MessageReactionAdd}
* @link https://discord.com/developers/docs/topics/gateway#message-reaction-remove-all
*/
export type MessageReactionRemoveAll = Pick<MessageReactionAdd, 'channelId' | 'messageId' | 'guildId'> export type MessageReactionRemoveAll = Pick<MessageReactionAdd, 'channelId' | 'messageId' | 'guildId'>
/**
* Represents when a reaction-emoji was removed from a message.
* Equals to MessageReactionAdd but with 'channelId', 'messageId', 'emoji' and 'guildId' properties guaranteed.
* @see {@link MessageReactionRemove}
* @see {@link Emoji}
* @link https://discord.com/developers/docs/topics/gateway#message-reaction-remove-emoji
*/
export type MessageReactionRemoveEmoji = Pick< export type MessageReactionRemoveEmoji = Pick<
MessageReactionAdd, MessageReactionAdd,
'channelId' | 'guildId' | 'messageId' | 'emoji' 'channelId' | 'guildId' | 'messageId' | 'emoji'
>; >;
/**
* Creates a new MessageReactionAdd object.
* @param session - Current application session.
* @param data - Discord message reaction to parse.
*/
export function NewMessageReactionAdd(session: Session, data: DiscordMessageReactionAdd): MessageReactionAdd { export function NewMessageReactionAdd(session: Session, data: DiscordMessageReactionAdd): MessageReactionAdd {
return { return {
userId: data.user_id, userId: data.user_id,