From 3873983b32e54af1d46846df99b9fca047494eb0 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 28 Nov 2024 18:56:26 +0000 Subject: [PATCH] Create effects list subcommand --- src/commands/effects.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/commands/effects.ts b/src/commands/effects.ts index df8a515..aa58d3b 100644 --- a/src/commands/effects.ts +++ b/src/commands/effects.ts @@ -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 ], + }); } }