From 55095866dedf3107ab36b9675b9d554c50ea988e Mon Sep 17 00:00:00 2001 From: nolan Date: Sun, 20 Jun 2021 21:02:57 -0700 Subject: [PATCH] Fix missing permission error for audit logs --- structure/client/components/observers/AuditLog.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/structure/client/components/observers/AuditLog.js b/structure/client/components/observers/AuditLog.js index cca4496..c172c47 100644 --- a/structure/client/components/observers/AuditLog.js +++ b/structure/client/components/observers/AuditLog.js @@ -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();