mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
18 lines
755 B
TypeScript
18 lines
755 B
TypeScript
import { eventHandlers } from "../../bot.ts";
|
|
import { cacheHandlers } from "../../cache.ts";
|
|
import { Channel } from "../../types/channels/channel.ts";
|
|
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
|
import { snowflakeToBigint } from "../../util/bigint.ts";
|
|
|
|
export async function handleThreadDelete(data: DiscordGatewayPayload) {
|
|
const payload = data.d as Channel;
|
|
|
|
const cachedChannel = await cacheHandlers.get("threads", snowflakeToBigint(payload.id));
|
|
if (!cachedChannel) return;
|
|
|
|
await cacheHandlers.delete("threads", snowflakeToBigint(payload.id));
|
|
await cacheHandlers.forEach("DELETE_MESSAGES_FROM_CHANNEL", { channelId: snowflakeToBigint(payload.id) });
|
|
|
|
eventHandlers.threadDelete?.(cachedChannel);
|
|
}
|