fix(GuildAuditLogs): default target to object with target_id (#2742)

This commit is contained in:
SpaceEEC
2018-08-15 09:58:27 +02:00
committed by GitHub
parent 6506252054
commit 700201e3fe

View File

@@ -148,6 +148,7 @@ class GuildAuditLogs {
* * An emoji * * An emoji
* * An invite * * An invite
* * A webhook * * A webhook
* * An object with an id key if target was deleted
* * An object where the keys represent either the new value or the old value * * An object where the keys represent either the new value or the old value
* @typedef {?Object|Guild|User|Role|GuildEmoji|Invite|Webhook} AuditLogEntryTarget * @typedef {?Object|Guild|User|Role|GuildEmoji|Invite|Webhook} AuditLogEntryTarget
*/ */
@@ -355,7 +356,7 @@ class GuildAuditLogsEntry {
} else if (targetType === Targets.MESSAGE) { } else if (targetType === Targets.MESSAGE) {
this.target = guild.client.users.get(data.target_id); this.target = guild.client.users.get(data.target_id);
} else { } else {
this.target = guild[`${targetType.toLowerCase()}s`].get(data.target_id); this.target = guild[`${targetType.toLowerCase()}s`].get(data.target_id) || { id: data.target_id };
} }
} }