making it testable

This commit is contained in:
Skillz4Killz
2021-10-25 00:11:07 +00:00
committed by GitHub
parent 5b4b10ae45
commit 231554d091
33 changed files with 459 additions and 781 deletions
+8 -8
View File
@@ -1,17 +1,17 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
// 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 payload = data.d as Channel;
const cachedChannel = await cacheHandlers.get("threads", snowflakeToBigint(payload.id));
if (!cachedChannel) return;
// 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) });
// await cacheHandlers.delete("threads", snowflakeToBigint(payload.id));
// await cacheHandlers.forEach("DELETE_MESSAGES_FROM_CHANNEL", { channelId: snowflakeToBigint(payload.id) });
eventHandlers.threadDelete?.(cachedChannel);
// eventHandlers.threadDelete?.(cachedChannel);
}