cache.threads

This commit is contained in:
Skillz4Killz
2021-06-13 13:34:18 +00:00
committed by GitHub
parent ee79d7da78
commit f2177e8ca6
6 changed files with 70 additions and 25 deletions
+4 -4
View File
@@ -1,14 +1,14 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { channelToThread } from "../../util/channel_to_thread.ts";
export async function handleThreadCreate(data: DiscordGatewayPayload) {
const payload = data.d as Channel;
const discordenoChannel = await structures.createDiscordenoChannel(payload);
await cacheHandlers.set("channels", discordenoChannel.id, discordenoChannel);
const thread = channelToThread(payload);
await cacheHandlers.set("threads", thread.id, thread);
eventHandlers.threadCreate?.(discordenoChannel);
eventHandlers.threadCreate?.(thread);
}