I have this code that gets sent when a roles permissions gets updating but its gets sent when moving a role and the permissions are the same, why is this happening?
module.exports = async (client, oldRole, newRole) => {
const allLogs = await newRole.guild.fetchAuditLogs({ type: "ROLE_UPDATE" });
const fetchModerator = await allLogs.entries.first();
if (oldRole.permissions !== newRole.permissions) {
const embed = new Discord.MessageEmbed()
.setAuthor({ name: fetchModerator.executor.tag, iconURL: fetchModerator.executor.displayAvatarURL({ dynamic: true }) })
.setTitle('Role Permissions Updated')
.setColor(config.colour)
.setTimestamp()
.addFields(
{
name: "__Role__",
value: `<@&${newRole.id}>`,
inline: true
},
{
name: "__Old Perms__",
value: oldRole.permissions.toArray().join('\n'),
inline: true
},
{
name: "__New Perms__",
value: newRole.permissions.toArray().join('\n'),
inline: true
},
{
name: "__Updater__",
value: `<@${fetchModerator.executor.id}>`,
inline: true
}
)
return logChannel.send({ embeds: [embed] })
}
}