import {ApplicationCommandOptionType, ApplicationCommandSubCommandData, ApplicationCommandType} from "discord.js" import {BaseChatInputCommandData, CommandWithSubcommandsData, SubcommandData} from "../types" import {UserTable} from "../../database/users.js" import {CharacterCreateCommand} from "./create.js" export class CharacterCommand extends CommandWithSubcommandsData { readonly create: CharacterCreateCommand readonly subcommands: SubcommandData[] private readonly _users: UserTable constructor({users}: { users: UserTable }) { super() this._users = users this.create = new CharacterCreateCommand({users}) this.subcommands = [ this.create, ] } readonly baseDefinition: BaseChatInputCommandData = { name: "character", type: ApplicationCommandType.ChatInput, description: "Commands to manage your characters.", } } const otherSubcommands: ApplicationCommandSubCommandData[] = [ { name: "select", type: ApplicationCommandOptionType.Subcommand, description: "Selects (and activates, if necessary) a character for use with other commands used in this server.", options: [ { name: "character", type: ApplicationCommandOptionType.String, description: "The character to switch to. If not supplied, shows you the current selected character.", autocomplete: true, required: false, }, ], }, { name: "activate", type: ApplicationCommandOptionType.Subcommand, description: "Allows a character to be targeted on the current server.", options: [ { name: "character", type: ApplicationCommandOptionType.String, description: "The character to activate on this server.", autocomplete: true, required: false, }, ], }, { name: "deactivate", type: ApplicationCommandOptionType.Subcommand, description: "Prevents a character from being targeted on the current server. Deselects them if they're selected.", options: [ { name: "character", type: ApplicationCommandOptionType.String, description: "The character to deactivate on this server.", }, ], }, { name: "edit", type: ApplicationCommandOptionType.Subcommand, description: "Edits an existing character. Note that characters currently in battle cannot be edited.", options: [ { name: "character", type: ApplicationCommandOptionType.String, description: "An existing character of yours to edit. Omit to edit the current character.", autocomplete: true, required: false, }, ], }, { name: "list", type: ApplicationCommandOptionType.Subcommand, description: "Lists your characters.", options: [ { name: "public", type: ApplicationCommandOptionType.Boolean, description: "True to share your character list with the current channel.", required: false, }, ], }, { name: "show", type: ApplicationCommandOptionType.Subcommand, description: "Shows the data about one of your characters.", options: [ { name: "character", type: ApplicationCommandOptionType.String, description: "An existing character of yours to display in this channel. Omit to display the current character.", autocomplete: true, required: false, }, { name: "public", type: ApplicationCommandOptionType.Boolean, description: "True to share your character list with the current channel.", required: false, }, ], }, { name: "archive", type: ApplicationCommandOptionType.Subcommand, description: "Removes a character from all servers and hides it from the default list view.", options: [ { name: "character", type: ApplicationCommandOptionType.String, description: "An existing unarchived character of yours to add to the archive.", autocomplete: true, required: false, }, ], }, { name: "unarchive", type: ApplicationCommandOptionType.Subcommand, description: "Unarchives a character.", options: [ { name: "character", type: ApplicationCommandOptionType.String, description: "An existing archived character of yours to take back out of the archive.", autocomplete: true, required: false, }, ], }, ]