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
@@ -40,12 +40,7 @@ export async function handleChannelDelete(data: DiscordGatewayPayload) {
].includes(payload.type)
) {
await cacheHandlers.delete("channels", snowflakeToBigint(payload.id));
cacheHandlers.forEach("messages", (message) => {
eventHandlers.debug?.("loop", `Running forEach messages loop in CHANNEL_DELTE file.`);
if (message.channelId === snowflakeToBigint(payload.id)) {
cacheHandlers.delete("messages", message.id);
}
});
await cacheHandlers.forEach("DELETE_MESSAGES_FROM_CHANNEL", { channelId: snowflakeToBigint(payload.id) });
}
await cacheHandlers.delete("channels", snowflakeToBigint(payload.id));