From 462808c0504b25a9fc8435753a67003d4a158532 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Sun, 4 Apr 2021 16:19:16 -0500 Subject: [PATCH] On guildMemberUpdate, return if certain things don't change, otherwise bot logs get spammed --- bot.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bot.js b/bot.js index ae28a58..d77cfe2 100644 --- a/bot.js +++ b/bot.js @@ -971,15 +971,14 @@ client.on('guildMemberUpdate', (oldMember, newMember) => { .setColor('c9ff00'); if (removedRoles.array().length > 0) { memberUpdateEmbed.addField("Roles Removed", removedRoles.map(r => `${r}`).join(' • ')); - } - if (addedRoles.array().length > 0) { + } else if (addedRoles.array().length > 0) { memberUpdateEmbed.addField("Roles Added", addedRoles.map(r => `${r}`).join(' • ')); - } - if (newMember.nickname !== oldMember.nickname) { + } else if (newMember.nickname !== oldMember.nickname) { memberUpdateEmbed.addField("Nickname Changed", `\`${oldMember.nickname}\` >> \`${newMember.nickname}\``) - } - if (newMember.user.tag !== oldMember.user.tag) { + } else if (newMember.user.tag !== oldMember.user.tag) { memberUpdateEmbed.addField("User Tag Changed", `\`${oldMember.user.tag}\` >> \`${newMember.user.tag}\``) + } else { + return; } collection.findOne({ guild_id: newMember.guild.id }, (error, result) => { if (error) {