From ec6f7da9f78a507039e98b3b580ea77f6ba7aec0 Mon Sep 17 00:00:00 2001 From: TheMonDon <11539895+TheMonDon@users.noreply.github.com> Date: Wed, 17 Jul 2024 09:25:13 -0500 Subject: [PATCH] Hopefully delete bulk delete messages --- events/Message/messageDeleteBulk.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/events/Message/messageDeleteBulk.mjs b/events/Message/messageDeleteBulk.mjs index f3e5c142..49081c09 100644 --- a/events/Message/messageDeleteBulk.mjs +++ b/events/Message/messageDeleteBulk.mjs @@ -16,13 +16,16 @@ export async function run(client, messages) { const noLogChans = (await db.get(`servers.${server.id}.logs.noLogChans`)) || []; if (noLogChans.includes(channel.id)) return; - const attachment = await generateFromMessages(messages, channel); + // Filter out messages with no author + const filteredMessages = messages.filter((message) => message.author); + + const attachment = await generateFromMessages(filteredMessages, channel); const embed = new EmbedBuilder() .setTitle('Bulk Messages Deleted') .setColor('#FF0000') .addFields([ { name: 'Deleted Messages', value: `Bulk deleted messages from ${channel} are available in the attached file.` }, - { name: 'Deleted Amount', value: messages.size.toLocaleString() }, + { name: 'Deleted Amount', value: filteredMessages.size.toLocaleString() }, ]); return server.channels.cache