Fix fuzzy /view to be consistent with its pages #345

Merged
Vylpes merged 3 commits from feature/154-add-fuzzy-search-3 into develop 2024-08-24 17:26:26 +01:00
3 changed files with 3 additions and 3 deletions
Showing only changes of commit 4c5704531e - Show all commits

View file

@ -5,7 +5,7 @@ import CardSearchHelper from "../helpers/CardSearchHelper.js";
export default class View extends ButtonEvent {
public override async execute(interaction: ButtonInteraction) {
const page = interaction.customId.split(" ")[1];
const results = interaction.customId.split(" ").splice(1);
const results = interaction.customId.split(" ").splice(2);
await interaction.deferUpdate();

View file

@ -24,7 +24,7 @@ export default class View extends Command {
await interaction.deferReply();
const searchResult = await CardSearchHelper.GenerateSearchQuery(name.value!.toString(), interaction.user.id, 0);
const searchResult = await CardSearchHelper.GenerateSearchQuery(name.value!.toString(), interaction.user.id, 5);
if (!searchResult) {
await interaction.editReply("No results found");

View file

@ -110,7 +110,7 @@ export default class CardSearchHelper {
.setCustomId(`view ${page + 1} ${results.join(" ")}`)
.setLabel("Next")
.setStyle(ButtonStyle.Primary)
.setDisabled(page + 1 == results.length));
.setDisabled(page == results.length));
return { embed, row, attachment, results };
}