From f40511682784b9d2f4dd30fdbf08441aa52d9ca3 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Wed, 3 Jun 2020 18:49:10 +0200 Subject: [PATCH] Don't spam the logs Signed-off-by: loicbersier --- event/listeners/log/channelUpdate.js | 2 +- event/listeners/log/roleUpdate.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/event/listeners/log/channelUpdate.js b/event/listeners/log/channelUpdate.js index b37656d3..3ddd35bf 100644 --- a/event/listeners/log/channelUpdate.js +++ b/event/listeners/log/channelUpdate.js @@ -11,7 +11,7 @@ class channelUpdateListener extends Listener { async exec(oldChannel, newChannel) { const logStats = await LogStats.findOne({where: {guild: newChannel.guild.id}}); - + if (oldChannel === newChannel) return; if (logStats) { const fetchedLogs = await newChannel.guild.fetchAuditLogs({ limit: 1, diff --git a/event/listeners/log/roleUpdate.js b/event/listeners/log/roleUpdate.js index 34d63b06..45eae9fb 100644 --- a/event/listeners/log/roleUpdate.js +++ b/event/listeners/log/roleUpdate.js @@ -12,8 +12,9 @@ class roleUpdateListener extends Listener { }); } - async exec(role) { - const guild = role.guild; + async exec(oldRole, newRole) { + if (oldRole === newRole) return; + const guild = oldRole.guild; const logStats = await LogStats.findOne({where: {guild: guild.id}}); if (logStats) { const fetchedLogs = await guild.fetchAuditLogs({ @@ -27,12 +28,12 @@ class roleUpdateListener extends Listener { let Embed = this.client.util.embed() .setColor('NAVY') .setTitle('Role updated') - .setDescription(`${role.name} got updated!`) + .setDescription(`${oldRole.name} got updated!`) .setTimestamp(); if (!creationLog) return channel.send(Embed); - Embed.setDescription(`${role.name} got updated by ${creationLog.executor}`); + Embed.setDescription(`${oldRole.name} got updated by ${creationLog.executor}`); channel.send(Embed); }