From ff42d7af72e940ae72c61d2c5164ae68f2708b96 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Tue, 24 Dec 2024 18:20:02 +0000 Subject: [PATCH] fix(InteractionResponses): do not use `in` if a string is passed --- .../interfaces/InteractionResponses.js | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/discord.js/src/structures/interfaces/InteractionResponses.js b/packages/discord.js/src/structures/interfaces/InteractionResponses.js index eef47619e..e383c65dd 100644 --- a/packages/discord.js/src/structures/interfaces/InteractionResponses.js +++ b/packages/discord.js/src/structures/interfaces/InteractionResponses.js @@ -162,24 +162,26 @@ class InteractionResponses { async reply(options) { if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied); - if ('ephemeral' in options) { - if (!deprecationEmittedForEphemeralOption) { - process.emitWarning( - `Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.`, - ); + if (typeof options !== 'string') { + if ('fetchReply' in options) { + if (!deprecationEmittedForEphemeralOption) { + process.emitWarning( + `Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.`, + ); - deprecationEmittedForEphemeralOption = true; + deprecationEmittedForEphemeralOption = true; + } } - } - if ('fetchReply' in options) { - if (!deprecationEmittedForFetchReplyOption) { - process.emitWarning( - // eslint-disable-next-line max-len - `Supplying "fetchReply" for interaction response options is deprecated. Utilize "withResponse" instead or fetch the response after using the method.`, - ); + if ('fetchReply' in options) { + if (!deprecationEmittedForFetchReplyOption) { + process.emitWarning( + // eslint-disable-next-line max-len + `Supplying "fetchReply" for interaction response options is deprecated. Utilize "withResponse" instead or fetch the response after using the method.`, + ); - deprecationEmittedForFetchReplyOption = true; + deprecationEmittedForFetchReplyOption = true; + } } } @@ -331,7 +333,7 @@ class InteractionResponses { async update(options) { if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied); - if ('fetchReply' in options) { + if (typeof options !== 'string' && 'fetchReply' in options) { if (!deprecationEmittedForFetchReplyOption) { process.emitWarning( // eslint-disable-next-line max-len