mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
Update Message Reaction Add
This commit is contained in:
parent
ffed682c25
commit
5a3076cbe3
@ -58,6 +58,7 @@ import Integration from "./structures/Integration.ts";
|
|||||||
import Guild from "./structures/guilds/Guild.ts";
|
import Guild from "./structures/guilds/Guild.ts";
|
||||||
import InteractionFactory from "./structures/interactions/InteractionFactory.ts";
|
import InteractionFactory from "./structures/interactions/InteractionFactory.ts";
|
||||||
import { InviteCreate, NewInviteCreate } from "./structures/Invite.ts";
|
import { InviteCreate, NewInviteCreate } from "./structures/Invite.ts";
|
||||||
|
import { MessageReactionAdd, NewMessageReactionAdd } from "./structures/MessageReaction.ts";
|
||||||
|
|
||||||
export type RawHandler<T> = (...args: [Session, number, T]) => void;
|
export type RawHandler<T> = (...args: [Session, number, T]) => void;
|
||||||
export type Handler<T extends unknown[]> = (...args: T) => unknown;
|
export type Handler<T extends unknown[]> = (...args: T) => unknown;
|
||||||
@ -265,7 +266,7 @@ export const AUTO_MODERATION_ACTION_EXECUTE: RawHandler<DiscordAutoModerationAct
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const MESSAGE_REACTION_ADD: RawHandler<DiscordMessageReactionAdd> = (session, _shardId, reaction) => {
|
export const MESSAGE_REACTION_ADD: RawHandler<DiscordMessageReactionAdd> = (session, _shardId, reaction) => {
|
||||||
session.emit("messageReactionAdd", null);
|
session.emit("messageReactionAdd", NewMessageReactionAdd(session, reaction));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MESSAGE_REACTION_REMOVE: RawHandler<DiscordMessageReactionRemove> = (session, _shardId, reaction) => {
|
export const MESSAGE_REACTION_REMOVE: RawHandler<DiscordMessageReactionRemove> = (session, _shardId, reaction) => {
|
||||||
@ -361,7 +362,7 @@ export interface Events {
|
|||||||
"messageCreate": Handler<[Message]>;
|
"messageCreate": Handler<[Message]>;
|
||||||
"messageUpdate": Handler<[Partial<Message>]>;
|
"messageUpdate": Handler<[Partial<Message>]>;
|
||||||
"messageDelete": Handler<[{ id: Snowflake, channelId: Snowflake, guildId?: Snowflake }]>;
|
"messageDelete": Handler<[{ id: Snowflake, channelId: Snowflake, guildId?: Snowflake }]>;
|
||||||
"messageReactionAdd": Handler<[MessageReaction]>;
|
"messageReactionAdd": Handler<[MessageReactionAdd]>;
|
||||||
"messageReactionRemove": Handler<[MessageReaction]>;
|
"messageReactionRemove": Handler<[MessageReaction]>;
|
||||||
"messageReactionRemoveAll": Handler<[MessageReaction]>;
|
"messageReactionRemoveAll": Handler<[MessageReaction]>;
|
||||||
"messageReactionRemoveEmoji": Handler<[MessageReaction]>;
|
"messageReactionRemoveEmoji": Handler<[MessageReaction]>;
|
||||||
|
@ -1,6 +1,27 @@
|
|||||||
import type { Session } from "../Session.ts";
|
import type { Session } from "../Session.ts";
|
||||||
import type { DiscordReaction } from "../../discordeno/mod.ts";
|
import type { DiscordMemberWithUser, DiscordMessageReactionAdd, DiscordReaction } from "../../discordeno/mod.ts";
|
||||||
import Emoji from "./Emoji.ts";
|
import Emoji from "./Emoji.ts";
|
||||||
|
import Member from "./Member.ts";
|
||||||
|
|
||||||
|
export interface MessageReactionAdd {
|
||||||
|
userId: string;
|
||||||
|
channelId: string;
|
||||||
|
messageId: string;
|
||||||
|
guildId?: string;
|
||||||
|
member?: Member;
|
||||||
|
emoji: Partial<Emoji>
|
||||||
|
}
|
||||||
|
|
||||||
|
export function NewMessageReactionAdd(session: Session, data: DiscordMessageReactionAdd): MessageReactionAdd {
|
||||||
|
return {
|
||||||
|
userId: data.user_id,
|
||||||
|
channelId: data.channel_id,
|
||||||
|
messageId: data.message_id,
|
||||||
|
guildId: data.guild_id,
|
||||||
|
member: data.member ? new Member(session, (data.member as DiscordMemberWithUser), (data.guild_id || "")) : undefined,
|
||||||
|
emoji: new Emoji(session, data.emoji),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a reaction
|
* Represents a reaction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user