|
|
|
import {BaseChatInputCommandData, CommandWithSubcommandsData, SubcommandData} from "../types"
|
|
|
|
import {ApplicationCommandType} from "discord.js"
|
|
|
|
import {BotRestartCommand} from "./restart"
|
|
|
|
import {BotShutdownCommand} from "./shutdown"
|
|
|
|
import {BotRebuildCommand} from "./rebuild"
|
|
|
|
import {UsersManager} from "../../managers/users";
|
|
|
|
|
|
|
|
export class BotCommand extends CommandWithSubcommandsData {
|
|
|
|
readonly rebuild: BotRebuildCommand
|
|
|
|
readonly restart: BotRestartCommand
|
|
|
|
readonly shutdown: BotShutdownCommand
|
|
|
|
readonly subcommands: SubcommandData[]
|
|
|
|
|
|
|
|
constructor({users, cleanUp}: { users: UsersManager, cleanUp: () => Promise<void> }) {
|
|
|
|
super()
|
|
|
|
this.rebuild = new BotRebuildCommand({users, cleanUp})
|
|
|
|
this.restart = new BotRestartCommand({users, cleanUp})
|
|
|
|
this.shutdown = new BotShutdownCommand({users, cleanUp})
|
|
|
|
this.subcommands = [
|
|
|
|
this.rebuild,
|
|
|
|
this.restart,
|
|
|
|
this.shutdown,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
readonly baseDefinition: BaseChatInputCommandData = {
|
|
|
|
name: "bot",
|
|
|
|
type: ApplicationCommandType.ChatInput,
|
|
|
|
description: "Commands to manage the bot's status.",
|
|
|
|
}
|
|
|
|
}
|