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;