From 62cf4e0105413972d5371bd1f1244450206ccf33 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 10 Aug 2022 21:50:02 +0300 Subject: [PATCH] bugfix --- src/structure/components/observers/GuildLogging.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/structure/components/observers/GuildLogging.js b/src/structure/components/observers/GuildLogging.js index 0ff1b20..5dd3f99 100644 --- a/src/structure/components/observers/GuildLogging.js +++ b/src/structure/components/observers/GuildLogging.js @@ -151,8 +151,9 @@ class GuildLogger extends Observer { const wrapper = message.guildWrapper; const settings = await wrapper.settings(); + let { member } = message; - if (!message.member) message.member = await message.guild.members.fetch(message.author.id).catch(() => null); + if (!member) member = await message.guild.members.fetch(message.author.id).catch(() => null); const { messages: messageLog } = settings; if (!messageLog.channel || !messageLog.enabled) return undefined; @@ -166,7 +167,7 @@ class GuildLogger extends Observer { return this.client.emit('logError', { guild: wrapper, logger: 'messageLogger', reason: 'MSGLOG_NO_PERMS', params: { missing: missing.join(', ') } }); if (bypass.length && message?.member.roles.cache.size) { - const roles = message.member.roles.cache.map((r) => r.id); + const roles = member.roles.cache.map((r) => r.id); for (const role of bypass) { if (roles.includes(role)) return undefined; } @@ -519,9 +520,10 @@ class GuildLogger extends Observer { const { guild, guildWrapper: wrapper } = oldMessage; if (!guild) return; + let { member } = oldMessage; - if (!oldMessage.member) oldMessage.member = await guild.members.fetch(oldMessage.author).catch(() => null); - const { member, channel, author, reference } = oldMessage; + if (!member) member = await guild.members.fetch(oldMessage.author).catch(() => null); + const { channel, author, reference } = oldMessage; const settings = await wrapper.settings(); const chatlogs = settings.messages;