From c684ac55e1d225740e67ab7bd5643de1b35f4594 Mon Sep 17 00:00:00 2001 From: Almeida Date: Thu, 24 Mar 2022 19:59:07 +0000 Subject: [PATCH] fix(GuildScheduledEvent): handle missing `image` (#7625) --- .../src/structures/GuildScheduledEvent.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/discord.js/src/structures/GuildScheduledEvent.js b/packages/discord.js/src/structures/GuildScheduledEvent.js index d6ee734af..70f25bf4b 100644 --- a/packages/discord.js/src/structures/GuildScheduledEvent.js +++ b/packages/discord.js/src/structures/GuildScheduledEvent.js @@ -153,11 +153,15 @@ class GuildScheduledEvent extends Base { this.entityMetadata ??= null; } - /** - * The cover image hash for this scheduled event - * @type {?string} - */ - this.image = data.image ?? null; + if ('image' in data) { + /** + * The cover image hash for this scheduled event + * @type {?string} + */ + this.image = data.image; + } else { + this.image ??= null; + } } /**