From 37e52486ff2443ed54af621af080b4650cbbd8f6 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:09:22 +0700 Subject: [PATCH] fix(GuildAuditLogsEntry): correct mapped `AuditLogChange` objects backport #10438 djs v14 --- src/structures/GuildAuditLogs.js | 7 ++++++- typings/index.d.ts | 12 +++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/structures/GuildAuditLogs.js b/src/structures/GuildAuditLogs.js index bd19fea..8a41f4e 100644 --- a/src/structures/GuildAuditLogs.js +++ b/src/structures/GuildAuditLogs.js @@ -457,7 +457,12 @@ class GuildAuditLogsEntry { * Specific property changes * @type {AuditLogChange[]} */ - this.changes = data.changes?.map(c => ({ key: c.key, old: c.old_value, new: c.new_value })) ?? []; + this.changes = + data.changes?.map(change => ({ + key: change.key, + ...('old_value' in change ? { old: change.old_value } : {}), + ...('new_value' in change ? { new: change.new_value } : {}), + })) ?? []; /** * The entry's id diff --git a/typings/index.d.ts b/typings/index.d.ts index 1c1e2de..15fb541 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -5197,11 +5197,13 @@ export interface AutoModerationActionMetadataOptions extends Partial = T | PromiseLike;