This commit is contained in:
Erik 2022-08-24 14:31:49 +03:00
parent 2f3a5a7a86
commit 339b1bf610
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -148,8 +148,8 @@ class AuditLogObserver extends Observer {
} }
async _fetchFirstEntry(guild, user, type, subtype = null) { async _fetchFirstEntry(guild, user, type, subtype = null) {
const me = await guild.resolveMember(this.client.user); const me = await guild.resolveMember(this.client.user.id);
if (!me.permissions.has('ViewAuditLog')) return null; if (!me?.permissions.has('ViewAuditLog')) return null;
type = AuditLogEvent[type]; type = AuditLogEvent[type];
const audit = await guild.fetchAuditLogs({ limit: 1, type }).catch(() => null); const audit = await guild.fetchAuditLogs({ limit: 1, type }).catch(() => null);
if (!audit || audit.entries.size === 0) return null; if (!audit || audit.entries.size === 0) return null;