Skip to content

Commit ff42d7a

Browse files
committed
fix(InteractionResponses): do not use in if a string is passed
1 parent 0fdbabe commit ff42d7a

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

packages/discord.js/src/structures/interfaces/InteractionResponses.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,24 +162,26 @@ class InteractionResponses {
162162
async reply(options) {
163163
if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
164164

165-
if ('ephemeral' in options) {
166-
if (!deprecationEmittedForEphemeralOption) {
167-
process.emitWarning(
168-
`Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.`,
169-
);
170-
171-
deprecationEmittedForEphemeralOption = true;
165+
if (typeof options !== 'string') {
166+
if ('fetchReply' in options) {
167+
if (!deprecationEmittedForEphemeralOption) {
168+
process.emitWarning(
169+
`Supplying "ephemeral" for interaction response options is deprecated. Utilize flags instead.`,
170+
);
171+
172+
deprecationEmittedForEphemeralOption = true;
173+
}
172174
}
173-
}
174175

175-
if ('fetchReply' in options) {
176-
if (!deprecationEmittedForFetchReplyOption) {
177-
process.emitWarning(
178-
// eslint-disable-next-line max-len
179-
`Supplying "fetchReply" for interaction response options is deprecated. Utilize "withResponse" instead or fetch the response after using the method.`,
180-
);
176+
if ('fetchReply' in options) {
177+
if (!deprecationEmittedForFetchReplyOption) {
178+
process.emitWarning(
179+
// eslint-disable-next-line max-len
180+
`Supplying "fetchReply" for interaction response options is deprecated. Utilize "withResponse" instead or fetch the response after using the method.`,
181+
);
181182

182-
deprecationEmittedForFetchReplyOption = true;
183+
deprecationEmittedForFetchReplyOption = true;
184+
}
183185
}
184186
}
185187

@@ -331,7 +333,7 @@ class InteractionResponses {
331333
async update(options) {
332334
if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);
333335

334-
if ('fetchReply' in options) {
336+
if (typeof options !== 'string' && 'fetchReply' in options) {
335337
if (!deprecationEmittedForFetchReplyOption) {
336338
process.emitWarning(
337339
// eslint-disable-next-line max-len

0 commit comments

Comments
 (0)