diff --git a/structure/client/components/observers/AuditLog.js b/structure/client/components/observers/AuditLog.js index c172c47..b863b02 100644 --- a/structure/client/components/observers/AuditLog.js +++ b/structure/client/components/observers/AuditLog.js @@ -27,7 +27,6 @@ class AuditLogObserver extends Observer { const settings = await guild.settings(); if(!settings.moderationLog.channel || !settings.moderationLog.infractions.includes('BAN')) return undefined; //This is checked by the infraction handling, but it may save resources if checked earlier. const audit = await this._fetchFirstEntry(guild, user, 'MEMBER_BAN_ADD'); - if(!audit || audit.executor.id === this.client.user.id) return undefined; new Infraction(this.client, { type: 'BAN', targetType: 'USER', @@ -42,7 +41,6 @@ class AuditLogObserver extends Observer { const settings = await guild.settings(); if(!settings.moderationLog.channel || !settings.moderationLog.infractions.includes('UNBAN')) return undefined; //This is checked by the infraction handling, but it may save resources if checked earlier. const audit = await this._fetchFirstEntry(guild, user, 'MEMBER_BAN_REMOVE'); - if(!audit || audit.executor.id === this.client.user.id) return undefined; new Infraction(this.client, { type: 'UNBAN', targetType: 'USER', @@ -57,7 +55,6 @@ class AuditLogObserver extends Observer { const settings = await member.guild.settings(); if(!settings.moderationLog.channel || !settings.moderationLog.infractions.includes('KICK')) return undefined; //This is checked by the infraction handling, but it may save resources if checked earlier. const audit = await this._fetchFirstEntry(member.guild, member.user, 'MEMBER_KICK'); - if(!audit || audit.executor.id === this.client.user.id) return undefined; new Infraction(this.client, { type: 'KICK', targetType: 'USER', @@ -80,7 +77,6 @@ class AuditLogObserver extends Observer { if(!oldMember.roles.cache.has(mutedRole) && newMember.roles.cache.has(mutedRole)) { //Member was assigned muted role. if(!settings.moderationLog.infractions.includes('MUTE')) return undefined; const audit = await this._fetchFirstEntry(newMember.guild, newMember.user, 'MEMBER_ROLE_UPDATE'); - if(!audit || audit.executor.id === this.client.user.id) return undefined; new Infraction(this.client, { type: 'MUTE', targetType: 'USER', @@ -93,7 +89,6 @@ class AuditLogObserver extends Observer { } else if(oldMember.roles.cache.has(mutedRole) && !newMember.roles.cache.has(mutedRole)) { //Member was unassigned muted role. if(!settings.moderationLog.infractions.includes('UNMUTE')) return undefined; const audit = await this._fetchFirstEntry(newMember.guild, newMember.user, 'MEMBER_ROLE_UPDATE'); - if(!audit || audit.executor.id === this.client.user.id) return undefined; new Infraction(this.client, { type: 'UNMUTE', targetType: 'USER', @@ -112,7 +107,7 @@ class AuditLogObserver extends Observer { if(audit.entries.size === 0) return null; const entry = audit.entries.filter((e) => e?.target?.id === user.id).first(); - if(!entry || entry.executor.bot) return null; + if(!entry || entry.executor.id === this.client.user.id) return null; if(entry.target.id !== user.id) return null; if(entry.action !== type) return null;