mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
f
This commit is contained in:
@@ -1,28 +1,17 @@
|
|||||||
import { eventHandlers } from "../../bot.ts";
|
import { eventHandlers } from "../../bot.ts";
|
||||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||||
|
import {
|
||||||
|
DiscordIntegrationCreateUpdate,
|
||||||
|
IntegrationCreateUpdate,
|
||||||
|
} from "../../types/integration/integration_create_update.ts";
|
||||||
|
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||||
|
|
||||||
export function handleIntegrationCreate(
|
export function handleIntegrationCreate(
|
||||||
data: DiscordGatewayPayload,
|
data: DiscordGatewayPayload,
|
||||||
) {
|
) {
|
||||||
const {
|
const payload = data.d as DiscordIntegrationCreateUpdate;
|
||||||
guild_id: guildId,
|
|
||||||
enable_emoticons: enableEmoticons,
|
|
||||||
expire_behavior: expireBehavior,
|
|
||||||
expire_grace_period: expireGracePeriod,
|
|
||||||
subscriber_count: subscriberCount,
|
|
||||||
role_id: roleId,
|
|
||||||
synced_at: syncedAt,
|
|
||||||
...rest
|
|
||||||
} = data.d as IntegrationCreateUpdateEvent;
|
|
||||||
|
|
||||||
eventHandlers.integrationCreate?.({
|
eventHandlers.integrationCreate?.(
|
||||||
...rest,
|
snakeKeysToCamelCase(payload) as IntegrationCreateUpdate,
|
||||||
guildId,
|
);
|
||||||
enableEmoticons,
|
|
||||||
expireBehavior,
|
|
||||||
expireGracePeriod,
|
|
||||||
syncedAt,
|
|
||||||
subscriberCount,
|
|
||||||
roleId,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import { eventHandlers } from "../../bot.ts";
|
import { eventHandlers } from "../../bot.ts";
|
||||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||||
|
import {
|
||||||
|
DiscordIntegrationDelete,
|
||||||
|
IntegrationDelete,
|
||||||
|
} from "../../types/integration/integration_delete.ts";
|
||||||
|
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||||
|
|
||||||
export function handleIntegrationDelete(data: DiscordGatewayPayload) {
|
export function handleIntegrationDelete(data: DiscordGatewayPayload) {
|
||||||
const {
|
const payload = data.d as DiscordIntegrationDelete;
|
||||||
guild_id: guildId,
|
|
||||||
application_id: applicationId,
|
|
||||||
...rest
|
|
||||||
} = data.d as IntegrationDeleteEvent;
|
|
||||||
|
|
||||||
eventHandlers.integrationDelete?.({
|
eventHandlers.integrationDelete?.(
|
||||||
...rest,
|
snakeKeysToCamelCase(payload) as IntegrationDelete,
|
||||||
applicationId,
|
);
|
||||||
guildId,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,15 @@
|
|||||||
import { eventHandlers } from "../../bot.ts";
|
import { eventHandlers } from "../../bot.ts";
|
||||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||||
|
import {
|
||||||
|
DiscordIntegrationCreateUpdate,
|
||||||
|
IntegrationCreateUpdate,
|
||||||
|
} from "../../types/integration/integration_create_update.ts";
|
||||||
|
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||||
|
|
||||||
export function handleIntegrationUpdate(data: DiscordGatewayPayload) {
|
export function handleIntegrationUpdate(data: DiscordGatewayPayload) {
|
||||||
const {
|
const payload = data.d as DiscordIntegrationCreateUpdate;
|
||||||
enable_emoticons: enableEmoticons,
|
|
||||||
expire_behavior: expireBehavior,
|
|
||||||
expire_grace_period: expireGracePeriod,
|
|
||||||
role_id: roleId,
|
|
||||||
subscriber_count: subscriberCount,
|
|
||||||
synced_at: syncedAt,
|
|
||||||
guild_id: guildId,
|
|
||||||
...rest
|
|
||||||
} = data.d as IntegrationCreateUpdateEvent;
|
|
||||||
|
|
||||||
eventHandlers.integrationUpdate?.({
|
eventHandlers.integrationUpdate?.(
|
||||||
...rest,
|
snakeKeysToCamelCase(payload) as IntegrationCreateUpdate,
|
||||||
guildId,
|
);
|
||||||
subscriberCount,
|
|
||||||
enableEmoticons,
|
|
||||||
expireGracePeriod,
|
|
||||||
roleId,
|
|
||||||
expireBehavior,
|
|
||||||
syncedAt,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user