Create effects list subcommand

This commit is contained in:
Ethan Lane 2024-11-28 18:56:26 +00:00
parent 0e1bc43ac4
commit 3873983b32

View file

@ -1,5 +1,6 @@
import {CommandInteraction, SlashCommandBuilder} from "discord.js";
import {Command} from "../type/command";
import EffectHelper from "../helpers/EffectHelper";
export default class Effects extends Command {
constructor() {
@ -10,7 +11,11 @@ export default class Effects extends Command {
.setDescription("Effects")
.addSubcommand(x => x
.setName("list")
.setDescription("List all effects I have"));
.setDescription("List all effects I have")
.addNumberOption(x => x
.setName("page")
.setDescription("The page number")
.setMinValue(1)));
}
public override async execute(interaction: CommandInteraction) {
@ -26,5 +31,15 @@ export default class Effects extends Command {
}
private async List(interaction: CommandInteraction) {
const pageOption = interaction.options.get("page");
const page = pageOption && Number(pageOption.value) ? Number(pageOption.value) : 1;
const result = await EffectHelper.GenerateEffectEmbed(interaction.user.id, page);
await interaction.reply({
embeds: [ result.embed ],
components: [ result.row ],
});
}
}