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
@@ -15,5 +15,5 @@ export async function handleMessageReactionRemoveAll(
await cacheHandlers.set("messages", payload.message_id, message);
}
eventHandlers.reactionRemoveAll?.(data.d);
eventHandlers.reactionRemoveAll?.(payload);
}
+3 -2
View File
@@ -1,10 +1,11 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { DiscordUser } from "../../types/users/user.ts";
import { DiscordUser, User } from "../../types/users/user.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";
export async function handleUserUpdate(data: DiscordGatewayPayload) {
const userData = data.d as DiscordUser;
const userData = camelKeysToSnakeCase(data.d as DiscordUser) as User;
const member = await cacheHandlers.get("members", userData.id);
if (!member) return;
+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);
}
+2 -2
View File
@@ -1,9 +1,9 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { DiscordWebhooksUpdate } from "../../types/webhooks/webhooks_update.ts";
import { DiscordWebhookUpdate } from "../../types/webhooks/webhooks_update.ts";
export function handleWebhooksUpdate(data: DiscordGatewayPayload) {
const options = data.d as DiscordWebhooksUpdate;
const options = data.d as DiscordWebhookUpdate;
eventHandlers.webhooksUpdate?.(
options.channel_id,
options.guild_id,