This commit is contained in:
Erik 2022-08-10 21:50:02 +03:00
parent 907933914c
commit 62cf4e0105
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

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