The command registry.

Constructors

Properties

builtInCommands: Map<string, Globals.RegisteredCommand<CommandTypeBase>[]> = ...
builtInNamedAccessCommands: Map<
    string,
    Globals.RegisteredCommand<NameAccessibleCommandType>[],
> = ...

All registered built-in name-accessible commands.

This does not include command aliases, for that, see CommandRegistry.namedAccessBuiltInCommandAliases.

builtInPrefixedAccessCommands: Map<
    string,
    Globals.RegisteredCommand<PrefixAccessibleCommandType>[],
> = ...

All registered built-in prefix-accessible commands.

This does not include command aliases, for that, see CommandRegistry.prefixedAccessBuiltInCommandAliases.

builtInRegexpAccessCommands: Map<
    `/${string}/${string}`,
    Globals.RegisteredCommand<RegExpAccessibleCommandType>[],
> = ...

All registered built-in regex-accessible commands.

This does not include command aliases, for that, see CommandRegistry.regexpAccessBuiltInCommandAliases.

commands: Map<string, Globals.RegisteredCommand<CommandTypeBase>[]> = ...

All registered commands, indexed by name.

This does not include command aliases, for that, see CommandRegistry.namedAccessCommandAliases, CommandRegistry.prefixedAccessCommandAliases, and CommandRegistry.regexpAccessCommandAliases.

customCommands: Map<string, Globals.RegisteredCommand<CommandTypeBase>[]> = ...

All registered custom commands with their prefixes are included in their key in the map.

This does not include command aliases, for that, see CommandRegistry.namedAccessCustomCommandAliases, CommandRegistry.prefixedAccessCustomCommandAliases, and CommandRegistry.regexpAccessCustomCommandAliases.

customNamedAccessCommands: Map<
    string,
    Globals.RegisteredCommand<NameAccessibleCommandType>[],
> = ...

All registered custom name-accessible commands.

This does not include command aliases, for that, see CommandRegistry.namedAccessCustomCommandAliases.

customPrefixedAccessCommands: Map<
    string,
    Globals.RegisteredCommand<PrefixAccessibleCommandType>[],
> = ...

All registered custom prefix-accessible commands.

This does not include command aliases, for that, see CommandRegistry.prefixedAccessCustomCommandAliases.

customRegexpAccessCommands: Map<
    `/${string}/${string}`,
    Globals.RegisteredCommand<RegExpAccessibleCommandType>[],
> = ...

All registered custom regex-accessible commands.

This does not include command aliases, for that, see CommandRegistry.regexpAccessCustomCommandAliases.

namedAccessBuiltInCommandAliases: Map<
    string,
    CommandAliasRegistryEntry<NameAccessibleCommandTypeAlias>[],
> = ...

All registered name-accessible built-in command aliases.

namedAccessCommandAliases: Map<
    string,
    CommandAliasRegistryEntry<NameAccessibleCommandTypeAlias>[],
> = ...

All registered name-accessible command aliases.

namedAccessCommands: Map<
    string,
    Globals.RegisteredCommand<NameAccessibleCommandType>[],
> = ...

All registered name-accessible commands.

This does not include command aliases, for that, see CommandRegistry.namedAccessCommandAliases.

namedAccessCustomCommandAliases: Map<
    string,
    CommandAliasRegistryEntry<NameAccessibleCommandTypeAlias>[],
> = ...

All registered name-accessible custom command aliases.

prefixedAccessBuiltInCommandAliases: Map<
    string,
    CommandAliasRegistryEntry<PrefixAccessibleCommandTypeAlias>[],
> = ...

All registered prefix-accessible built-in command aliases.

prefixedAccessCommandAliases: Map<
    string,
    CommandAliasRegistryEntry<PrefixAccessibleCommandTypeAlias>[],
> = ...

All registered prefix-accessible command aliases.

prefixedAccessCommands: Map<
    string,
    Globals.RegisteredCommand<PrefixAccessibleCommandType>[],
> = ...

All registered prefix-accessible commands.

This does not include command aliases, for that, see CommandRegistry.prefixedAccessCommandAliases.

prefixedAccessCustomCommandAliases: Map<
    string,
    CommandAliasRegistryEntry<PrefixAccessibleCommandTypeAlias>[],
> = ...

All registered prefix-accessible custom command aliases.

regexpAccessBuiltInCommandAliases: Map<
    `/${string}/${string}`,
    CommandAliasRegistryEntry<RegExpAccessibleCommandTypeAlias>[],
> = ...

All registered regex-accessible built-in command aliases.

regexpAccessCommandAliases: Map<
    `/${string}/${string}`,
    CommandAliasRegistryEntry<RegExpAccessibleCommandTypeAlias>[],
> = ...

All registered regex-accessible command aliases.

regexpAccessCommands: Map<
    `/${string}/${string}`,
    Globals.RegisteredCommand<RegExpAccessibleCommandType>[],
> = ...

All registered regex-accessible commands.

This does not include command aliases, for that, see CommandRegistry.regexpAccessCommandAliases.

regexpAccessCustomCommandAliases: Map<
    `/${string}/${string}`,
    CommandAliasRegistryEntry<RegExpAccessibleCommandTypeAlias>[],
> = ...

All registered regex-accessible custom command aliases.

Methods

  • Gets a command by the beginning of the command string.

    Parameters

    • commandName: string

      The beginning of the command string, should not include spaces.

    • Optionaloptions: CommandRegistryGetCommandOptions = {}

      The options for the command retrieval.

      Options for the CommandRegistry.getCommand method.

      • OptionalincludeAliases?: boolean

        Whether or not to include aliases.

        Note: Aliases will have a lower priority than actual commands, so if a command with the same name is found, it will be returned instead of the one referenced by the alias.

        true
        
      • OptionaltypeFilter?: "built-in" | "custom"

        The type of command to filter by.

    Returns
        | undefined
        | {
            command: Globals.RegisteredCommand<CommandTypeBase>;
            currentCommandName: string;
        }

    The command, or undefined if not found.

    If the typeFilter is not built-in, custom, or undefined.

  • Gets a command by the beginning of the command string, but based on a player's permissions.

    Parameters

    • commandName: string

      The beginning of the command string, should not include spaces.

    • player: loosePlayerType

      The player to check permissions for.

    • Optionaloptions: CommandRegistryGetCommandOptions = {}

      The options for the command retrieval.

      Options for the CommandRegistry.getCommand method.

      • OptionalincludeAliases?: boolean

        Whether or not to include aliases.

        Note: Aliases will have a lower priority than actual commands, so if a command with the same name is found, it will be returned instead of the one referenced by the alias.

        true
        
      • OptionaltypeFilter?: "built-in" | "custom"

        The type of command to filter by.

    Returns undefined | Globals.RegisteredCommand<CommandTypeBase>

    The command, or undefined if not found.

    If the options.typeFilter is not built-in, custom, or undefined.

    Add support for command aliases.

  • Gets all matching commands by the beginning of the command string.

    Parameters

    • commandName: string

      The beginning of the command string, should not include spaces.

    • OptionaltypeFilter: "built-in" | "custom"

      The type of command to filter by.

    Returns Globals.RegisteredCommand<CommandTypeBase>[]

    The list of matching commands.

    If the typeFilter is not built-in, custom, or undefined.

    Add support for command aliases.

  • Unregisters a command.

    Parameters

    Returns boolean

    Whether or not the command was successfully unregistered, if false, the command was not found in the registry, so it was either already unregistered or never registered in the first place.

    If the method recieves more or less than 1 argument.

    If the command paramter is not an instance of the RegisteredCommand class.

    If the one of the command's aliases has an invalid type.