This commit is contained in:
ITOH
2021-04-12 09:30:45 +02:00
parent 51e27d8f17
commit b9bd29ebf8
44 changed files with 268 additions and 221 deletions
@@ -9,9 +9,9 @@ import { snakeKeysToCamelCase } from "../../util/utils.ts";
export function handleIntegrationCreate(
data: DiscordGatewayPayload,
) {
const payload = data.d as DiscordIntegrationCreateUpdate;
eventHandlers.integrationCreate?.(
snakeKeysToCamelCase(payload) as IntegrationCreateUpdate,
snakeKeysToCamelCase<IntegrationCreateUpdate>(
data.d as DiscordIntegrationCreateUpdate,
),
);
}
@@ -1,15 +1,15 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { IntegrationCreateUpdate } from "../../types/integration/integration_create_update.ts";
import {
DiscordIntegrationDelete,
IntegrationDelete,
} from "../../types/integration/integration_delete.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts";
export function handleIntegrationDelete(data: DiscordGatewayPayload) {
const payload = data.d as DiscordIntegrationDelete;
eventHandlers.integrationDelete?.(
snakeKeysToCamelCase(payload) as IntegrationDelete,
snakeKeysToCamelCase<IntegrationCreateUpdate>(
data.d as DiscordIntegrationDelete,
),
);
}
@@ -7,9 +7,9 @@ import {
import { snakeKeysToCamelCase } from "../../util/utils.ts";
export function handleIntegrationUpdate(data: DiscordGatewayPayload) {
const payload = data.d as DiscordIntegrationCreateUpdate;
eventHandlers.integrationUpdate?.(
snakeKeysToCamelCase(payload) as IntegrationCreateUpdate,
snakeKeysToCamelCase<IntegrationCreateUpdate>(
data.d as DiscordIntegrationCreateUpdate,
),
);
}