diff --git a/packages/core/src/structures/interactions.ts b/packages/core/src/structures/interactions.ts index a7b6bda..6e2d8b7 100644 --- a/packages/core/src/structures/interactions.ts +++ b/packages/core/src/structures/interactions.ts @@ -232,6 +232,17 @@ export abstract class BaseInteraction implements Model { return message; } + async deleteEphemeral(messageId?: Snowflake): Promise { + await Webhook.prototype.deleteFollowUp.call( + { + id: this.session.applicationId, + session: this.session, + token: this.token, + }, + messageId + ); + } + async deleteFollowUp( messageId: Snowflake, threadId?: Snowflake diff --git a/packages/core/src/structures/webhook.ts b/packages/core/src/structures/webhook.ts index 317ee7e..1680158 100644 --- a/packages/core/src/structures/webhook.ts +++ b/packages/core/src/structures/webhook.ts @@ -131,7 +131,17 @@ export class Webhook implements Model { return new Message(this.session, message); } - async deleteMessage( + /** + * @deprecated you might want to delete an ephemeral message (deleteFollowUp) + * */ + deleteMessage( + messageId: Snowflake, + threadId?: Snowflake + ): Promise { + return this.deleteThreadMessage(messageId, threadId); + } + + async deleteThreadMessage( messageId: Snowflake, threadId?: Snowflake ): Promise { @@ -145,6 +155,18 @@ export class Webhook implements Model { ); } + async deleteFollowUp(messageId?: Snowflake): Promise { + if (!this.token) { + throw new Error('No token found'); + } + + await this.session.rest.delete( + messageId + ? WEBHOOK_MESSAGE(this.id, this.token, messageId) + : WEBHOOK_MESSAGE_ORIGINAL(this.id, this.token) + ); + } + async editMessage( messageId?: Snowflake, options?: EditMessageWithThread