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 {
|
export default class View extends ButtonEvent {
|
||||||
public override async execute(interaction: ButtonInteraction) {
|
public override async execute(interaction: ButtonInteraction) {
|
||||||
const page = interaction.customId.split(" ")[1];
|
const page = interaction.customId.split(" ")[1];
|
||||||
const results = interaction.customId.split(" ").splice(1);
|
const results = interaction.customId.split(" ").splice(2);
|
||||||
|
|
||||||
await interaction.deferUpdate();
|
await interaction.deferUpdate();
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default class View extends Command {
|
||||||
|
|
||||||
await interaction.deferReply();
|
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) {
|
if (!searchResult) {
|
||||||
await interaction.editReply("No results found");
|
await interaction.editReply("No results found");
|
||||||
|
|
|
@ -110,7 +110,7 @@ export default class CardSearchHelper {
|
||||||
.setCustomId(`view ${page + 1} ${results.join(" ")}`)
|
.setCustomId(`view ${page + 1} ${results.join(" ")}`)
|
||||||
.setLabel("Next")
|
.setLabel("Next")
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setDisabled(page + 1 == results.length));
|
.setDisabled(page == results.length));
|
||||||
|
|
||||||
return { embed, row, attachment, results };
|
return { embed, row, attachment, results };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue