From 7779069e320303285537025ca0c5c7bf4b9499b1 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Sun, 30 Apr 2017 17:57:42 -0500 Subject: [PATCH] add audit logs "extras" (#1435) * add audit logs "extras" * whoops * Update GuildAuditLogs.js --- src/structures/GuildAuditLogs.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/structures/GuildAuditLogs.js b/src/structures/GuildAuditLogs.js index 36ad5131c..a1af82c82 100644 --- a/src/structures/GuildAuditLogs.js +++ b/src/structures/GuildAuditLogs.js @@ -176,6 +176,33 @@ class GuildAuditLogsEntry { */ this.id = data.id; + /** + * Any extra data from the entry + * @type {?Object|Role|GuildMember} + */ + this.extra = null; + if (data.options) { + if (data.action_type === Actions.MEMBER_PRUNE) { + this.extra = { + removed: data.options.members_removed, + days: data.options.delete_member_days, + }; + } else { + switch (data.options.type) { + case 'member': + this.extra = guild.members.get(this.options.id); + if (!this.extra) this.extra = { id: this.options.id }; + break; + case 'role': + this.extra = guild.roles.get(this.options.id); + if (!this.extra) this.extra = { id: this.options.id, name: this.options.role_name }; + break; + default: + break; + } + } + } + if ([Targets.USER, Targets.GUILD].includes(targetType)) { /** * The target of this entry