diff --git a/src/structure/components/observers/GuildLogging.js b/src/structure/components/observers/GuildLogging.js index 0c62be3..0ff1b20 100644 --- a/src/structure/components/observers/GuildLogging.js +++ b/src/structure/components/observers/GuildLogging.js @@ -152,11 +152,7 @@ class GuildLogger extends Observer { const wrapper = message.guildWrapper; const settings = await wrapper.settings(); - if (!message.member) try { - message.member = await message.guild.members.fetch(message.author.id); - } catch (_) { - // Member not found, do nothing - } + if (!message.member) message.member = await message.guild.members.fetch(message.author.id).catch(() => null); const { messages: messageLog } = settings; if (!messageLog.channel || !messageLog.enabled) return undefined; @@ -169,7 +165,7 @@ class GuildLogger extends Observer { if (missing.length) 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) { + if (bypass.length && message?.member.roles.cache.size) { const roles = message.member.roles.cache.map((r) => r.id); for (const role of bypass) { if (roles.includes(role)) return undefined;