Skip to main content
Version: Next

MessageCommandParser

MessageCommandParser

Parses message content into structured command data with options and subcommands.

Signature
class MessageCommandParser {
constructor(message: Message, prefix: string[], schema: (command: string) => MessageCommandOptionsSchema)
getArgs() => ;
options: void
getOption(name: string) => T | undefined;
getCommand() => string;
getSubcommand() => string | undefined;
getSubcommandGroup() => string | undefined;
getPrefix() => ;
getFullCommand() => ;
parse() => ParsedMessageCommand;
}

constructor

method
(message: Message, prefix: string[], schema: (command: string) => MessageCommandOptionsSchema) => MessageCommandParser

Creates a new message command parser.

getArgs

method
() =>

Gets the parsed command arguments.

options

property

Gets the message command options object for easy access to typed option values.

getOption

method
(name: string) => T | undefined

Gets a specific option value by name.

getCommand

method
() => string

Gets the main command name.

getSubcommand

method
() => string | undefined

Gets the subcommand name if present.

getSubcommandGroup

method
() => string | undefined

Gets the subcommand group name if present.

getPrefix

method
() =>

Gets the prefix used in the message.

getFullCommand

method
() =>

Gets the full command including subcommand group and subcommand.

parse

Parses the message content into structured command data.