mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
Merge branch 'fix-handlers-integration' into fix-helpers
This commit is contained in:
@@ -1,28 +1,17 @@
|
||||
import { eventHandlers } from "../../bot.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(
|
||||
data: DiscordGatewayPayload,
|
||||
) {
|
||||
const {
|
||||
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;
|
||||
const payload = data.d as DiscordIntegrationCreateUpdate;
|
||||
|
||||
eventHandlers.integrationCreate?.({
|
||||
...rest,
|
||||
guildId,
|
||||
enableEmoticons,
|
||||
expireBehavior,
|
||||
expireGracePeriod,
|
||||
syncedAt,
|
||||
subscriberCount,
|
||||
roleId,
|
||||
});
|
||||
eventHandlers.integrationCreate?.(
|
||||
snakeKeysToCamelCase(payload) as IntegrationCreateUpdate,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import { eventHandlers } from "../../bot.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) {
|
||||
const {
|
||||
guild_id: guildId,
|
||||
application_id: applicationId,
|
||||
...rest
|
||||
} = data.d as IntegrationDeleteEvent;
|
||||
const payload = data.d as DiscordIntegrationDelete;
|
||||
|
||||
eventHandlers.integrationDelete?.({
|
||||
...rest,
|
||||
applicationId,
|
||||
guildId,
|
||||
});
|
||||
eventHandlers.integrationDelete?.(
|
||||
snakeKeysToCamelCase(payload) as IntegrationDelete,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
import { eventHandlers } from "../../bot.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) {
|
||||
const {
|
||||
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;
|
||||
const payload = data.d as DiscordIntegrationCreateUpdate;
|
||||
|
||||
eventHandlers.integrationUpdate?.({
|
||||
...rest,
|
||||
guildId,
|
||||
subscriberCount,
|
||||
enableEmoticons,
|
||||
expireGracePeriod,
|
||||
roleId,
|
||||
expireBehavior,
|
||||
syncedAt,
|
||||
});
|
||||
eventHandlers.integrationUpdate?.(
|
||||
snakeKeysToCamelCase(payload) as IntegrationCreateUpdate,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user