Add the dropdown menu to the interaction output
Some checks failed
Test / build (push) Failing after 8s
Some checks failed
Test / build (push) Failing after 8s
This commit is contained in:
parent
5ebc5ff27c
commit
c5fc99d658
3 changed files with 20 additions and 7 deletions
|
@ -34,7 +34,7 @@ export default class Inventory extends ButtonEvent {
|
|||
await interaction.editReply({
|
||||
files: [ embed.image ],
|
||||
embeds: [ embed.embed ],
|
||||
components: [ embed.row ],
|
||||
components: [ embed.row1, embed.row2 ],
|
||||
});
|
||||
} catch (e) {
|
||||
AppLogger.LogError("Button/Inventory", `Error generating inventory page for ${member.user.username} with id ${member.user.id}: ${e}`);
|
||||
|
|
|
@ -47,7 +47,7 @@ export default class Inventory extends Command {
|
|||
await interaction.followUp({
|
||||
files: [ embed.image ],
|
||||
embeds: [ embed.embed ],
|
||||
components: [ embed.row ],
|
||||
components: [ embed.row1, embed.row2 ],
|
||||
});
|
||||
} catch (e) {
|
||||
AppLogger.LogError("Commands/Inventory", e as string);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ActionRowBuilder, AttachmentBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
|
||||
import { ActionRowBuilder, AttachmentBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder } from "discord.js";
|
||||
import Inventory from "../database/entities/app/Inventory";
|
||||
import { CoreClient } from "../client/client";
|
||||
import EmbedColours from "../constants/EmbedColours";
|
||||
|
@ -24,7 +24,8 @@ interface InventoryPageCards {
|
|||
|
||||
interface ReturnedInventoryPage {
|
||||
embed: EmbedBuilder,
|
||||
row: ActionRowBuilder<ButtonBuilder>,
|
||||
row1: ActionRowBuilder<ButtonBuilder>,
|
||||
row2: ActionRowBuilder<StringSelectMenuBuilder>,
|
||||
image: AttachmentBuilder,
|
||||
}
|
||||
|
||||
|
@ -99,7 +100,7 @@ export default class InventoryHelper {
|
|||
.setColor(EmbedColours.Ok)
|
||||
.setImage("attachment://page.png");
|
||||
|
||||
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||
const row1 = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`inventory ${userid} ${page - 1}`)
|
||||
|
@ -112,9 +113,21 @@ export default class InventoryHelper {
|
|||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(page + 1 == pages.length));
|
||||
|
||||
const row2 = new ActionRowBuilder<StringSelectMenuBuilder>()
|
||||
.addComponents(
|
||||
new StringSelectMenuBuilder()
|
||||
.setCustomId("inventory")
|
||||
.setPlaceholder(`${currentPage.name} (${currentPage.seriesSubpage + 1})`)
|
||||
.addOptions(...pages.map(x =>
|
||||
new StringSelectMenuOptionBuilder()
|
||||
.setLabel(`${x.name} (${x.seriesSubpage + 1})`.substring(0, 100))
|
||||
.setDescription("Quick navigate to page...")
|
||||
.setDefault(currentPage.id == x.id)
|
||||
.setValue(x.id.toString()))));
|
||||
|
||||
const buffer = await ImageHelper.GenerateCardImageGrid(currentPage.cards.map(x => ({ id: x.id, path: x.path })));
|
||||
const image = new AttachmentBuilder(buffer, { name: "page.png" });
|
||||
|
||||
return { embed, row, image };
|
||||
return { embed, row1, row2, image };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue