Skip to content

Commit

Permalink
fix(GuildAuditLogsEntry): executor can be missing (#5500)
Browse files Browse the repository at this point in the history
  • Loading branch information
almostSouji committed Apr 14, 2021
1 parent fe93a7e commit e9bf206
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/structures/GuildAuditLogs.js
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion typings/index.d.ts
Expand Up @@ -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;
Expand Down

0 comments on commit e9bf206

Please sign in to comment.