Skip to content

Commit

Permalink
fix(InteractionResponses): do not use in if a string is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Dec 24, 2024
1 parent 0fdbabe commit ff42d7a
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
);

deprecationEmittedForEphemeralOption = true;
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;
}
}
}

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;
}
}
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ff42d7a

Please sign in to comment.