diff --git a/src/structures/GuildAuditLogs.js b/src/structures/GuildAuditLogs.js index aab133d4cc3a..81a3d0d78e6e 100644 --- a/src/structures/GuildAuditLogs.js +++ b/src/structures/GuildAuditLogs.js @@ -319,11 +319,13 @@ class GuildAuditLogsEntry { /** * The user that executed this entry - * @type {User} + * @type {?User} */ - this.executor = guild.client.options.partials.includes(PartialTypes.USER) - ? guild.client.users.add({ id: data.user_id }) - : guild.client.users.cache.get(data.user_id); + this.executor = data.user_id + ? guild.client.options.partials.includes(PartialTypes.USER) + ? guild.client.users.add({ id: data.user_id }) + : guild.client.users.cache.get(data.user_id) + : null; /** * An entry in the audit log representing a specific change. diff --git a/typings/index.d.ts b/typings/index.d.ts index 1da3ff222750..121127bb56e8 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -744,7 +744,7 @@ declare module 'discord.js' { public changes: AuditLogChange[] | null; public readonly createdAt: Date; public readonly createdTimestamp: number; - public executor: User; + public executor: User | null; public extra: object | Role | GuildMember | null; public id: Snowflake; public reason: string | null;