Fix the dropdown having the wrong page value

This commit is contained in:
Ethan Lane 2024-09-21 15:12:11 +01:00
parent a71b33d879
commit c115cd92a1

View file

@ -113,6 +113,8 @@ export default class InventoryHelper {
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setDisabled(page + 1 == pages.length)); .setDisabled(page + 1 == pages.length));
let pageNum = 0;
const row2 = new ActionRowBuilder<StringSelectMenuBuilder>() const row2 = new ActionRowBuilder<StringSelectMenuBuilder>()
.addComponents( .addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
@ -123,7 +125,7 @@ export default class InventoryHelper {
.setLabel(`${x.name} (${x.seriesSubpage + 1})`.substring(0, 100)) .setLabel(`${x.name} (${x.seriesSubpage + 1})`.substring(0, 100))
.setDescription("Quick navigate to page...") .setDescription("Quick navigate to page...")
.setDefault(currentPage.id == x.id) .setDefault(currentPage.id == x.id)
.setValue(x.id.toString())))); .setValue((pageNum++).toString()))));
const buffer = await ImageHelper.GenerateCardImageGrid(currentPage.cards.map(x => ({ id: x.id, path: x.path }))); const buffer = await ImageHelper.GenerateCardImageGrid(currentPage.cards.map(x => ({ id: x.id, path: x.path })));
const image = new AttachmentBuilder(buffer, { name: "page.png" }); const image = new AttachmentBuilder(buffer, { name: "page.png" });