Browse Source

On guildMemberUpdate, return if certain things don't change, otherwise bot logs get spammed

master
Abheek Dhawan 4 years ago
parent
commit
462808c050
  1. 11
      bot.js

11
bot.js

@ -971,15 +971,14 @@ client.on('guildMemberUpdate', (oldMember, newMember) => {
.setColor('c9ff00'); .setColor('c9ff00');
if (removedRoles.array().length > 0) { if (removedRoles.array().length > 0) {
memberUpdateEmbed.addField("Roles Removed", removedRoles.map(r => `${r}`).join(' • ')); memberUpdateEmbed.addField("Roles Removed", removedRoles.map(r => `${r}`).join(' • '));
} } else if (addedRoles.array().length > 0) {
if (addedRoles.array().length > 0) {
memberUpdateEmbed.addField("Roles Added", addedRoles.map(r => `${r}`).join(' • ')); memberUpdateEmbed.addField("Roles Added", addedRoles.map(r => `${r}`).join(' • '));
} } else if (newMember.nickname !== oldMember.nickname) {
if (newMember.nickname !== oldMember.nickname) {
memberUpdateEmbed.addField("Nickname Changed", `\`${oldMember.nickname}\` >> \`${newMember.nickname}\``) memberUpdateEmbed.addField("Nickname Changed", `\`${oldMember.nickname}\` >> \`${newMember.nickname}\``)
} } else if (newMember.user.tag !== oldMember.user.tag) {
if (newMember.user.tag !== oldMember.user.tag) {
memberUpdateEmbed.addField("User Tag Changed", `\`${oldMember.user.tag}\` >> \`${newMember.user.tag}\``) memberUpdateEmbed.addField("User Tag Changed", `\`${oldMember.user.tag}\` >> \`${newMember.user.tag}\``)
} else {
return;
} }
collection.findOne({ guild_id: newMember.guild.id }, (error, result) => { collection.findOne({ guild_id: newMember.guild.id }, (error, result) => {
if (error) { if (error) {

Loading…
Cancel
Save