Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GuildAuditLogsEntry): executor can be missing #5500

Merged
merged 1 commit into from Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -727,7 +727,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