Fix missing permission error for audit logs

This commit is contained in:
nolan 2021-06-20 21:02:57 -07:00
parent a85ed6535b
commit 55095866de

View File

@ -107,7 +107,8 @@ class AuditLogObserver extends Observer {
}
async _fetchFirstEntry(guild, user, type) {
const audit = await guild.fetchAuditLogs({ limit: 2 }); //Just incase >_>
if(!guild.me.hasPermission('VIEW_AUDIT_LOG')) return null;
const audit = await guild.fetchAuditLogs({ limit: 1 });
if(audit.entries.size === 0) return null;
const entry = audit.entries.filter((e) => e?.target?.id === user.id).first();