types: fix new types issues (#829)

* feat: add tests for deleting channel overwrites

* fix: typings
This commit is contained in:
Skillz4Killz
2021-04-12 02:26:55 -04:00
committed by GitHub
parent b7a2b0ed55
commit 51e27d8f17
31 changed files with 329 additions and 273 deletions
+7 -4
View File
@@ -1,11 +1,14 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { DiscordVoiceServerUpdate, VoiceServerUpdate } from "../../types/voice/voice_server_update.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts";
export async function handleVoiceServerUpdate(data: DiscordPayload) {
const payload = data.d as DiscordVoiceServerUpdate;
export async function handleVoiceServerUpdate(data: DiscordGatewayPayload) {
const payload = snakeKeysToCamelCase(data.d as DiscordVoiceServerUpdate) as VoiceServerUpdate;
const guild = await cacheHandlers.get("guilds", payload.guild_id);
const guild = await cacheHandlers.get("guilds", payload.guildId);
if (!guild) return;
eventHandlers.voiceServerUpdate?.(payload.token, guild, payload.endpoint);
eventHandlers.voiceServerUpdate?.(payload, guild);
}