From 59a70c903985ff9503e29a78d292dd66bf7c2500 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Fri, 2 Apr 2021 15:32:29 -0500 Subject: [PATCH] Attempt to add reaction logs --- index.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 25a2359..f4b1fe5 100644 --- a/index.js +++ b/index.js @@ -280,7 +280,7 @@ client.on('messageDelete', message => { client.on('messageDeleteBulk', messages => { const numMessages = messages.array().length; const messagesChannel = messages.array()[0].channel; - const deleteEmbed = new Discord.MessageEmbed() + const bulkDeleteEmbed = new Discord.MessageEmbed() .setTitle(`${numMessages} Messages Bulk Deleted`) .addField(`Channel`, messagesChannel.name) .setFooter("Channel ID: " + messagesChannel.id) @@ -293,7 +293,7 @@ client.on('messageDeleteBulk', messages => { } botLogsChannel = result.bot_logs_id; if (messagesChannel.guild.channels.cache.get(botLogsChannel)) { - messagesChannel.guild.channels.cache.get(botLogsChannel).send(deleteEmbed).catch(console.error); + messagesChannel.guild.channels.cache.get(botLogsChannel).send(bulkDeleteEmbed).catch(console.error); } }); }); @@ -352,6 +352,30 @@ client.on('channelCreate', channel => { }); }); +client.on('messageReactionAdd', messageReaction, user => { + const userTag = user.tag; + const emoji = messageReaction.emoji.name; + const numEmoji = messageReaction.emoji.count; + const messageContent = messageReaction.message.content; + let channelCategory; + const channelCreateEmbed = new Discord.MessageEmbed() + .setTitle("Reaction Added") + .addField("Message", messageContent) + .addField("Reactions", `${userTag} reacted with ${emoji}, along with ${numEmoji - 1} other people in ${messageReaction.message.channel.name}.`) + .setFooter("ID: " + channelID) + .setTimestamp() + .setColor('00aaff'); + collection.findOne({ guild_id: messageReaction.message.guild.id}, (error, result) => { + if(error) { + console.error; + } + botLogsChannel = result.bot_logs_id; + if (messageReaction.message.guild.channels.cache.get(botLogsChannel)) { + messageReaction.message.guild.channels.cache.get(botLogsChannel).send(channelCreateEmbed).catch(console.error); + } + }); +}); + /*client.on('userUpdate', (oldUser, newUser) => { if (oldUser.bot) { return;