From 30abb470b9b5598f623241dbe13ce424ebbd345f Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Tue, 30 Jan 2024 19:28:09 +0100 Subject: [PATCH] fix defer --- src/handlers/interactionErrorHandler.ts | 6 ++++-- src/interactions/components/action-previous-button.ts | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/handlers/interactionErrorHandler.ts b/src/handlers/interactionErrorHandler.ts index 7bc5d50..66635f8 100644 --- a/src/handlers/interactionErrorHandler.ts +++ b/src/handlers/interactionErrorHandler.ts @@ -62,7 +62,8 @@ export const handleError = async ( return; case false: logger.debug('Responding with error embed'); - return await interaction.editReply(errorReply); + interaction.deferred ? await interaction.editReply(errorReply) : await interaction.reply(errorReply); + return; } } else if (interaction instanceof MessageComponentInteraction) { switch (interaction.replied) { @@ -74,7 +75,8 @@ export const handleError = async ( return; case false: logger.debug('Responding with error embed'); - return await interaction.editReply(errorReply); + interaction.deferred ? await interaction.editReply(errorReply) : await interaction.reply(errorReply); + return; } } else { logger.debug( diff --git a/src/interactions/components/action-previous-button.ts b/src/interactions/components/action-previous-button.ts index 87d2260..2a66152 100644 --- a/src/interactions/components/action-previous-button.ts +++ b/src/interactions/components/action-previous-button.ts @@ -58,7 +58,7 @@ class ActionPreviousButton extends BaseComponentInteraction { translator: TFunction ) { logger.debug('No tracks in history.'); - return await interaction.editReply({ + return await interaction.reply({ embeds: [ new EmbedBuilder() .setDescription( @@ -68,7 +68,8 @@ class ActionPreviousButton extends BaseComponentInteraction { }) ) .setColor(this.embedOptions.colors.warning) - ] + ], + ephemeral: true }); }