Fix fuzzy /view to be consistent with its pages #345
3 changed files with 3 additions and 3 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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 };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue