You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1.1 KiB

import {
ApplicationCommandType,
type CommandContext,
CommandOptionType,
SlashCommand,
type SlashCreator
} from "slash-create";
import {
CharacterOptionTemplate,
AbstractCharacterStatusCommand,
type GameCharacterData,
type LoadedCharacterData
} from "./base.js";
export class CharacterStatusCommand extends AbstractCharacterStatusCommand {
constructor(creator: SlashCreator) {
super(creator, {
name: "status",
description: "Gets the status of the given character(s).",
type: ApplicationCommandType.CHAT_INPUT,
guildIDs: process.env.DEVELOPMENT_GUILD_ID,
options: [
{
...CharacterOptionTemplate,
name: "character",
description: "The name of the character(s) to get the status of.",
required: true,
},
]
});
}
async process(ctx: CommandContext, characters: Map<string, readonly GameCharacterData[]>): Promise<readonly [string, LoadedCharacterData[]] | readonly [string, LoadedCharacterData] | readonly LoadedCharacterData[] | LoadedCharacterData | string> {
return characters.get("character")!.flatMap((x) => x.success ? [x] : []);
}
}