mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
19 lines
716 B
TypeScript
19 lines
716 B
TypeScript
import { eventHandlers } from "../../bot.ts";
|
|
import { cacheHandlers } from "../../cache.ts";
|
|
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
|
import { DiscordMessageDeleteBulk } from "../../types/messages/message_delete_bulk.ts";
|
|
|
|
export async function handleMessageDeleteBulk(data: DiscordGatewayPayload) {
|
|
const payload = data.d as DiscordMessageDeleteBulk;
|
|
const channel = await cacheHandlers.get("channels", payload.channel_id);
|
|
if (!channel) return;
|
|
|
|
return Promise.all(payload.ids.map(async (id) => {
|
|
eventHandlers.messageDelete?.(
|
|
{ id, channel },
|
|
await cacheHandlers.get("messages", id),
|
|
);
|
|
await cacheHandlers.delete("messages", id);
|
|
}));
|
|
}
|