This commit is contained in:
Erik 2022-08-09 18:51:06 +03:00
parent d81553e668
commit 5d6c5c5747
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -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;