From 47d95cde48d40dd8bb69b65ca068c7e1604c3dae Mon Sep 17 00:00:00 2001 From: Cpt-Dingus <100243410+Cpt-Dingus@users.noreply.github.com> Date: Mon, 14 Aug 2023 01:03:21 +0200 Subject: [PATCH] Pagination, factoids: Hotfix and semantics correction --- src/core/pagination.ts | 7 +++++-- src/modules/factoids/factoids.ts | 6 ++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/pagination.ts b/src/core/pagination.ts index c48ad5d..ec06b8a 100644 --- a/src/core/pagination.ts +++ b/src/core/pagination.ts @@ -16,6 +16,7 @@ import * as util from '../core/util.js'; let currentPage = 1; let stoppedManually = false; +let deletedManually = false; const prevButton: ButtonBuilder = new ButtonBuilder() .setCustomId('prevButton') @@ -182,6 +183,7 @@ async function paginate( case 'trashButton': await buttonInteraction.deferUpdate(); + deletedManually = true; await interaction.deleteReply(); continueButtonListener.stop(); @@ -198,13 +200,14 @@ async function paginate( await interaction.deleteReply(); } // Otherwise just remove the buttons - else { - const payload = await getPayload(payloads); + else if (!deletedManually) { + const payload = getPayload(payloads); await interaction.editReply(payload); } // Resets the variables for further uses currentPage = 1; stoppedManually = false; + deletedManually = false; }); } diff --git a/src/modules/factoids/factoids.ts b/src/modules/factoids/factoids.ts index 8ab4ac5..2adc440 100644 --- a/src/modules/factoids/factoids.ts +++ b/src/modules/factoids/factoids.ts @@ -227,13 +227,11 @@ async function confirmDeletion( interaction ) ) { - case util.ConfirmEmbedResponse.Denied: { + case util.ConfirmEmbedResponse.Denied: return false; - } - case util.ConfirmEmbedResponse.Confirmed: { + case util.ConfirmEmbedResponse.Confirmed: return true; - } } }