From 254ecd44bedc8b4ce6f47061678f239eedef83d0 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Fri, 2 Apr 2021 15:22:10 -0500 Subject: [PATCH] Attempt message bulk delete log --- index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/index.js b/index.js index ca75ac9..70005dc 100644 --- a/index.js +++ b/index.js @@ -277,6 +277,27 @@ client.on('messageDelete', message => { }); }); +client.on('messageDeleteBulk', messages => { + const numMessages = messages.array().length; + const messagesChannel = messages.array()[0].channel; + const deleteEmbed = new Discord.MessageEmbed() + .setTitle(`${numMessages} Messages Bulk Deleted`) + .addField(`Channel`, messagesChannel.name) + .setFooter("Channel ID: " + messagesChannel.id) + .setTimestamp() + .setColor('e7778b'); + + collection.findOne({ guild_id: message.guild.id}, (error, result) => { + if(error) { + console.error; + } + botLogsChannel = result.bot_logs_id; + if (message.guild.channels.cache.get(botLogsChannel)) { + message.guild.channels.cache.get(botLogsChannel).send(deleteEmbed).catch(console.error); + } + }); +}); + client.on('messageUpdate', (originalMessage, editedMessage) => { if (editedMessage.author) { if (editedMessage.author.bot) {