From c5fb54852906898ffb19282dd60168dfc6fb2eba Mon Sep 17 00:00:00 2001 From: Ryan Munro Date: Tue, 19 Apr 2022 23:56:45 +1000 Subject: [PATCH] fix(InteractionResponses): use optional chaining on nullable property (#7812) * fix(InteractionResponses): use optional chaining on nullable property * fix: one more spot --- packages/discord.js/src/structures/InteractionCollector.js | 2 +- .../src/structures/interfaces/InteractionResponses.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/discord.js/src/structures/InteractionCollector.js b/packages/discord.js/src/structures/InteractionCollector.js index cfbb9170d..36b0f6103 100644 --- a/packages/discord.js/src/structures/InteractionCollector.js +++ b/packages/discord.js/src/structures/InteractionCollector.js @@ -211,7 +211,7 @@ class InteractionCollector extends Collector { this.stop('messageDelete'); } - if (message.interaction.id === this.messageInteractionId) { + if (message.interaction?.id === this.messageInteractionId) { this.stop('messageDelete'); } } diff --git a/packages/discord.js/src/structures/interfaces/InteractionResponses.js b/packages/discord.js/src/structures/interfaces/InteractionResponses.js index 3a05b8811..91beea939 100644 --- a/packages/discord.js/src/structures/interfaces/InteractionResponses.js +++ b/packages/discord.js/src/structures/interfaces/InteractionResponses.js @@ -197,7 +197,7 @@ class InteractionResponses { }); this.deferred = true; - return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction.id); + return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction?.id); } /** @@ -232,7 +232,7 @@ class InteractionResponses { }); this.replied = true; - return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction.id); + return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction?.id); } /**