Add image grid to inventory command #277
4 changed files with 11 additions and 7 deletions
|
@ -25,6 +25,7 @@ export default class Inventory extends ButtonEvent {
|
|||
const embed = await InventoryHelper.GenerateInventoryPage(member.user.username, member.user.id, Number(page));
|
||||
|
||||
await interaction.update({
|
||||
files: [ embed.image ],
|
||||
embeds: [ embed.embed ],
|
||||
components: [ embed.row ],
|
||||
});
|
||||
|
@ -34,4 +35,4 @@ export default class Inventory extends ButtonEvent {
|
|||
await interaction.reply("No page for user found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,4 +88,4 @@ export default class Drop extends Command {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ export default class Inventory extends Command {
|
|||
const embed = await InventoryHelper.GenerateInventoryPage(user.username, user.id, pageNumber);
|
||||
|
||||
await interaction.reply({
|
||||
files: [ embed.image ],
|
||||
embeds: [ embed.embed ],
|
||||
components: [ embed.row ],
|
||||
});
|
||||
|
@ -47,4 +48,4 @@ export default class Inventory extends Command {
|
|||
await interaction.reply("No page for user found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
|
||||
import { ActionRowBuilder, AttachmentBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
|
||||
import Inventory from "../database/entities/app/Inventory";
|
||||
import { CoreClient } from "../client/client";
|
||||
import EmbedColours from "../constants/EmbedColours";
|
||||
|
@ -26,7 +26,7 @@ interface InventoryPageCards {
|
|||
interface ReturnedInventoryPage {
|
||||
embed: EmbedBuilder,
|
||||
row: ActionRowBuilder<ButtonBuilder>,
|
||||
image: Buffer,
|
||||
image: AttachmentBuilder,
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,7 +96,8 @@ export default class InventoryHelper {
|
|||
.setTitle(username)
|
||||
.setDescription(`**${currentPage.name} (${currentPage.seriesSubpage + 1})**\n${currentPage.cards.map(x => `[${x.id}] ${x.name} (${CardRarityToString(x.type)}) x${x.quantity}`).join("\n")}`)
|
||||
.setFooter({ text: `Page ${page + 1} of ${pages.length}` })
|
||||
.setColor(EmbedColours.Ok);
|
||||
.setColor(EmbedColours.Ok)
|
||||
.setImage("attachment://page.png");
|
||||
|
||||
const row = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
|
@ -111,7 +112,8 @@ export default class InventoryHelper {
|
|||
.setStyle(ButtonStyle.Primary)
|
||||
.setDisabled(page + 1 == pages.length));
|
||||
|
||||
const image = await this.GenerateInventoryImage(currentPage);
|
||||
const buffer = await this.GenerateInventoryImage(currentPage);
|
||||
const image = new AttachmentBuilder(buffer, { name: "page.png" });
|
||||
|
||||
return { embed, row, image };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue