Create list effects command #412

Merged
Vylpes merged 15 commits from feature/379-list-effects into develop 2024-12-07 22:32:20 +00:00
Showing only changes of commit 3873983b32 - Show all commits

View file

@ -1,5 +1,6 @@
import {CommandInteraction, SlashCommandBuilder} from "discord.js"; import {CommandInteraction, SlashCommandBuilder} from "discord.js";
import {Command} from "../type/command"; import {Command} from "../type/command";
import EffectHelper from "../helpers/EffectHelper";
export default class Effects extends Command { export default class Effects extends Command {
constructor() { constructor() {
@ -10,7 +11,11 @@ export default class Effects extends Command {
.setDescription("Effects") .setDescription("Effects")
.addSubcommand(x => x .addSubcommand(x => x
.setName("list") .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) { public override async execute(interaction: CommandInteraction) {
@ -26,5 +31,15 @@ export default class Effects extends Command {
} }
private async List(interaction: CommandInteraction) { 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 ],
});
} }
} }