Create series command #190

Merged
Vylpes merged 5 commits from feature/99-series-command into develop 2024-03-31 15:49:30 +01:00
3 changed files with 22 additions and 23 deletions
Showing only changes of commit 55b7f3fea9 - Show all commits

View file

@ -8,15 +8,15 @@ export default class Series extends ButtonEvent {
const subaction = interaction.customId.split(" ")[1]; const subaction = interaction.customId.split(" ")[1];
switch(subaction) { switch(subaction) {
case "view": case "view":
await this.ViewSeries(interaction); await this.ViewSeries(interaction);
break; break;
case "list": case "list":
await this.ListSeries(interaction); await this.ListSeries(interaction);
break; break;
default: default:
AppLogger.LogWarn("Commands/Series", `Subaction doesn't exist: ${subaction}`); AppLogger.LogWarn("Commands/Series", `Subaction doesn't exist: ${subaction}`);
interaction.reply("Subaction doesn't exist."); interaction.reply("Subaction doesn't exist.");
} }
} }

View file

@ -1,7 +1,6 @@
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js"; import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { Command } from "../type/command"; import { Command } from "../type/command";
import { CoreClient } from "../client/client"; import { CoreClient } from "../client/client";
import EmbedColours from "../constants/EmbedColours";
import AppLogger from "../client/appLogger"; import AppLogger from "../client/appLogger";
import SeriesHelper from "../helpers/SeriesHelper"; import SeriesHelper from "../helpers/SeriesHelper";
@ -24,22 +23,22 @@ export default class Series extends Command {
.addSubcommand(x => .addSubcommand(x =>
x x
.setName("list") .setName("list")
.setDescription("List all series")); .setDescription("List all series")) as SlashCommandBuilder;
} }
public override async execute(interaction: CommandInteraction) { public override async execute(interaction: CommandInteraction) {
if (!interaction.isChatInputCommand()) return; if (!interaction.isChatInputCommand()) return;
switch (interaction.options.getSubcommand()) { switch (interaction.options.getSubcommand()) {
case "view": case "view":
await this.ViewSeries(interaction); await this.ViewSeries(interaction);
break; break;
case "list": case "list":
await this.ListSeries(interaction); await this.ListSeries(interaction);
break; break;
default: default:
AppLogger.LogWarn("Commands/Series", `Subcommand doesn't exist: ${interaction.options.getSubcommand()}`); AppLogger.LogWarn("Commands/Series", `Subcommand doesn't exist: ${interaction.options.getSubcommand()}`);
await interaction.reply("Subcommand doesn't exist."); await interaction.reply("Subcommand doesn't exist.");
} }
} }

View file

@ -1,7 +1,7 @@
import { CommandInteraction } from "discord.js"; import { CommandInteraction, SlashCommandBuilder } from "discord.js";
export abstract class Command { export abstract class Command {
public CommandBuilder: any; public CommandBuilder: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">;
abstract execute(interaction: CommandInteraction): Promise<void>; abstract execute(interaction: CommandInteraction): Promise<void>;
} }