Fix fuzzy /view to be consistent with its pages (#345)
- Fix the `/view` command to have a set amount of cards in its page rotation - This is done now by updating it so instead of requerying each page turn it instead queries once at the start and passes the top 5 results to the button event #154 Reviewed-on: #345 Reviewed-by: VylpesTester <tester@vylpes.com> Co-authored-by: Ethan Lane <ethan@vylpes.com> Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
parent
79a4d18df3
commit
66243e6742
5 changed files with 153 additions and 14 deletions
|
@ -5,11 +5,11 @@ 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 query = interaction.customId.split(" ").splice(1).join(" ");
|
||||
const results = interaction.customId.split(" ").splice(2);
|
||||
|
||||
await interaction.deferUpdate();
|
||||
|
||||
const searchResult = await CardSearchHelper.GenerateSearchPage(query, interaction.user.id, Number(page));
|
||||
const searchResult = await CardSearchHelper.GenerateSearchPageFromQuery(results, interaction.user.id, Number(page));
|
||||
|
||||
if (!searchResult) {
|
||||
await interaction.followUp("No results found");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue