mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
types: fix new types issues (#829)
* feat: add tests for deleting channel overwrites * fix: typings
This commit is contained in:
@@ -15,5 +15,5 @@ export async function handleMessageReactionRemoveAll(
|
||||
await cacheHandlers.set("messages", payload.message_id, message);
|
||||
}
|
||||
|
||||
eventHandlers.reactionRemoveAll?.(data.d);
|
||||
eventHandlers.reactionRemoveAll?.(payload);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user