Create effects list subcommand
This commit is contained in:
parent
0e1bc43ac4
commit
3873983b32
1 changed files with 16 additions and 1 deletions
|
@ -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 ],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue