This commit is contained in:
ITOH
2021-04-06 21:40:03 +02:00
parent 484e995140
commit 59633b8ed6
3 changed files with 27 additions and 50 deletions
@@ -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,
);
}