Add integration-Update/Delete action

This commit is contained in:
Nicolás Serna 2022-07-04 21:53:31 -03:00
parent c05d8113bd
commit 59755f2f6e

View File

@ -26,7 +26,8 @@ import type {
// DiscordThreadMembersUpdate, // DiscordThreadMembersUpdate,
DiscordThreadListSync, DiscordThreadListSync,
DiscordWebhookUpdate, DiscordWebhookUpdate,
DiscordIntegration DiscordIntegration,
DiscordIntegrationDelete
} from "../vendor/external.ts"; } from "../vendor/external.ts";
import type { Snowflake } from "../util/Snowflake.ts"; import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts"; import type { Session } from "../session/Session.ts";
@ -173,6 +174,14 @@ export const INTEGRATION_CREATE: RawHandler<DiscordIntegration> = (session, _sha
session.emit("integrationCreate", new Integration(session, payload)); session.emit("integrationCreate", new Integration(session, payload));
}; };
export const INTEGRATION_UPDATE: RawHandler<DiscordIntegration> = (session, _shardId, payload) => {
session.emit("integrationCreate", new Integration(session, payload));
};
export const INTEGRATION_DELETE: RawHandler<DiscordIntegrationDelete> = (session, _shardId, payload) => {
session.emit("integrationDelete", { id: payload.id, guildId: payload.guild_id, applicationId: payload.application_id });
};
/* /*
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", null);
@ -233,6 +242,8 @@ export interface Events {
"threadListSync": Handler<[{ guildId: Snowflake, channelIds: Snowflake[], threads: ThreadChannel[], members: ThreadMember[] }]> "threadListSync": Handler<[{ guildId: Snowflake, channelIds: Snowflake[], threads: ThreadChannel[], members: ThreadMember[] }]>
"interactionCreate": Handler<[Interaction]>; "interactionCreate": Handler<[Interaction]>;
"integrationCreate": Handler<[DiscordIntegration]>; "integrationCreate": Handler<[DiscordIntegration]>;
"integrationUpdate": Handler<[DiscordIntegration]>;
"integrationDelete": Handler<[{ id: Snowflake, guildId?: Snowflake, applicationId?: Snowflake }]>;
"raw": Handler<[unknown, number]>; "raw": Handler<[unknown, number]>;
"webhooksUpdate": Handler<[{ guildId: Snowflake, channelId: Snowflake }]>; "webhooksUpdate": Handler<[{ guildId: Snowflake, channelId: Snowflake }]>;
} }