change(cacheHandlers): forEach logic

This commit is contained in:
ITOH
2021-07-08 19:47:54 +02:00
parent cdd9e106b9
commit 5f66c7950d
4 changed files with 71 additions and 64 deletions
+1 -6
View File
@@ -11,12 +11,7 @@ export async function handleThreadDelete(data: DiscordGatewayPayload) {
if (!cachedChannel) return;
await cacheHandlers.delete("threads", snowflakeToBigint(payload.id));
cacheHandlers.forEach("messages", (message) => {
eventHandlers.debug?.("loop", `Running forEach messages loop in THREAD_DELETE file.`);
if (message.channelId === snowflakeToBigint(payload.id)) {
cacheHandlers.delete("messages", message.id);
}
});
await cacheHandlers.forEach("DELETE_MESSAGES_FROM_CHANNEL", { channelId: snowflakeToBigint(payload.id) });
eventHandlers.threadDelete?.(cachedChannel);
}