WIP: Paginate series
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Ethan Lane 2024-03-22 19:03:04 +00:00
parent 1e7b221276
commit 0d520066cf
3 changed files with 148 additions and 20 deletions

View file

@ -3,6 +3,7 @@ import { Command } from "../type/command";
import { CoreClient } from "../client/client";
import EmbedColours from "../constants/EmbedColours";
import AppLogger from "../client/appLogger";
import SeriesHelper from "../helpers/SeriesHelper";
export default class Series extends Command {
constructor() {
@ -58,30 +59,14 @@ export default class Series extends Command {
return;
}
const description = series.cards
.map(x => { return `[${x.id}] ${x.name}` })
.join("\n");
const embed = SeriesHelper.GenerateSeriesViewPage(series.id, 0);
const embed = new EmbedBuilder()
.setTitle(series.name)
.setColor(EmbedColours.Ok)
.setDescription(description)
.setFooter({ text: `${series.id} · ${series.cards.length} cards` });
await interaction.reply({ embeds: [ embed ]});
await interaction.reply({ embeds: [ embed!.embed ], components: [ embed!.row ]});
}
private async ListSeries(interaction: CommandInteraction) {
const description = CoreClient.Cards
.map(x => { return `[${x.id}] ${x.name}` })
.join("\n");
const embed = SeriesHelper.GenerateSeriesListPage(0);
const embed = new EmbedBuilder()
.setTitle("Series")
.setColor(EmbedColours.Ok)
.setDescription(description)
.setFooter({ text: `${CoreClient.Cards.length} series` });
await interaction.reply({ embeds: [ embed ]});
await interaction.reply({ embeds: [ embed!.embed ], components: [ embed!.row ]});
}
}