From 5e29df051050fbf48fc2439a5aff46cdefca2370 Mon Sep 17 00:00:00 2001 From: monbrey Date: Tue, 25 Oct 2022 09:14:19 +1100 Subject: [PATCH] feat: allow deletion of ephemeral messages --- packages/discord.js/src/errors/ErrorCodes.js | 2 +- .../src/structures/interfaces/InteractionResponses.js | 1 - packages/discord.js/typings/index.d.ts | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/discord.js/src/errors/ErrorCodes.js b/packages/discord.js/src/errors/ErrorCodes.js index f0566a0433a8..9ec36057baaf 100644 --- a/packages/discord.js/src/errors/ErrorCodes.js +++ b/packages/discord.js/src/errors/ErrorCodes.js @@ -128,6 +128,7 @@ * @property {'InteractionAlreadyReplied'} InteractionAlreadyReplied * @property {'InteractionNotReplied'} InteractionNotReplied * @property {'InteractionEphemeralReplied'} InteractionEphemeralReplied + * This property is deprecated. * @property {'CommandInteractionOptionNotFound'} CommandInteractionOptionNotFound * @property {'CommandInteractionOptionType'} CommandInteractionOptionType @@ -273,7 +274,6 @@ const keys = [ 'InteractionAlreadyReplied', 'InteractionNotReplied', - 'InteractionEphemeralReplied', 'CommandInteractionOptionNotFound', 'CommandInteractionOptionType', diff --git a/packages/discord.js/src/structures/interfaces/InteractionResponses.js b/packages/discord.js/src/structures/interfaces/InteractionResponses.js index f8f32ebe607d..f85fd7fe9a14 100644 --- a/packages/discord.js/src/structures/interfaces/InteractionResponses.js +++ b/packages/discord.js/src/structures/interfaces/InteractionResponses.js @@ -164,7 +164,6 @@ class InteractionResponses { * .catch(console.error); */ async deleteReply() { - if (this.ephemeral) throw new DiscordjsError(ErrorCodes.InteractionEphemeralReplied); await this.webhook.deleteMessage('@original'); } diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index e2586331a58d..3f68e6f21e4c 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -3246,6 +3246,7 @@ export enum DiscordjsErrorCodes { InteractionAlreadyReplied = 'InteractionAlreadyReplied', InteractionNotReplied = 'InteractionNotReplied', + /** @deprecated */ InteractionEphemeralReplied = 'InteractionEphemeralReplied', CommandInteractionOptionNotFound = 'CommandInteractionOptionNotFound',