Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
Pagination, factoids: Hotfix and semantics correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Cpt-Dingus committed Aug 13, 2023
1 parent aad7f52 commit 47d95cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/core/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -182,6 +183,7 @@ async function paginate(
case 'trashButton':
await buttonInteraction.deferUpdate();

deletedManually = true;
await interaction.deleteReply();

continueButtonListener.stop();
Expand All @@ -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;
});
}

Expand Down
6 changes: 2 additions & 4 deletions src/modules/factoids/factoids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 47d95cd

Please sign in to comment.