Add image grid to the series view command (#294)
All checks were successful
Deploy To Stage / build (push) Successful in 10s
Deploy To Stage / deploy (push) Successful in 16s

- Add the image grid to the series view command
- Moved the image generation logic to its own class so we can have common logic between them
- Fixed a bug where paginated commands that deferred (series view, inventory) were creating new messages, rather than updating

#279

Reviewed-on: #294
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:
Ethan Lane 2024-07-09 17:45:50 +01:00 committed by Vylpes
parent 1b9857dfe5
commit acfdcb17f2
6 changed files with 72 additions and 51 deletions

View file

@ -47,6 +47,8 @@ export default class Series extends Command {
AppLogger.LogSilly("Commands/Series/View", `Parameters: id=${id?.value}`);
await interaction.deferReply();
if (!id) return;
const series = CoreClient.Cards.find(x => x.id == id.value);
@ -54,13 +56,17 @@ export default class Series extends Command {
if (!series) {
AppLogger.LogVerbose("Commands/Series/View", "Series not found.");
await interaction.reply("Series not found.");
await interaction.followUp("Series not found.");
return;
}
const embed = SeriesHelper.GenerateSeriesViewPage(series.id, 0);
const embed = await SeriesHelper.GenerateSeriesViewPage(series.id, 0);
await interaction.reply({ embeds: [ embed!.embed ], components: [ embed!.row ]});
await interaction.followUp({
embeds: [ embed!.embed ],
components: [ embed!.row ],
files: [ embed!.image ],
});
}
private async ListSeries(interaction: CommandInteraction) {
@ -68,4 +74,4 @@ export default class Series extends Command {
await interaction.reply({ embeds: [ embed!.embed ], components: [ embed!.row ]});
}
}
}