A command registry. This keeps track of all the commands and command groups registered in the client.

Hierarchy

  • CommandRegistry

Constructors

Properties

The client that this command registry will be used by.

Memberof

CommandRegistry

commands: Collection<string, Command<CommandTrigger>>

A collection of the commands registered to this registry, mapped by the command's name and the command.

Memberof

CommandRegistry

groups: Collection<string, CommandGroup>

A collection of the groups registered to this registry, mapped by the group's ID and the group.

Memberof

CommandRegistry

Methods

  • Register a command to this registry.

    Parameters

    Returns CommandRegistry

    This command registry.

    Throws

    Throws if the command's groupID is not registered.

    Throws

    Throws if the command's name is already registered.

    Throws

    Throws if the command's name is also specified as its own alias.

    Throws

    Throws if any of the command's aliases is already registered.

    Emits

    client#commandRegistered

  • Register multiple commands to this register.

    Parameters

    Returns CommandRegistry

    This command registry.

    Throws

    Throws if any of the command's groupID is not registered.

    Throws

    Throws if any of the command's name is already registered.

    Throws

    Throws if any of the command's name is also specified as its own alias.

    Throws

    Throws if any of the command's aliases is already registered.

    Emits

    client#commandRegistered

  • Register all commands in a directory. Commands must be located inside subdirectories with the groupID as name. Groups must be registered beforehand, otherwise this method will not pick them up.

    Parameters

    • path: string

      The resolved path to the directory containing all commands.

    Returns CommandRegistry

    This command registry.

    Throws

    Throws if any of the command's groupID is not registered. This may happen if a command with an unregistered group is located inside a registered group subdirectory.

    Throws

    Throws if any of the command's name is already registered.

    Throws

    Throws if any the command's name is also specified as its own alias.

    Throws

    Throws if any of the command's aliases is already registered.

    Emits

    client#commandRegistered

  • Register the default commands. Default groups should be registered before using this. For more information, check out DefaultCommands.

    Parameters

    • registerSlash: boolean = true

      If true it will register the default slash commands otherwise, the regular ones will be registered.

    Returns CommandRegistry

    This command registry.

    Emits

    client#commandRegistered

  • Register multiple command groups.

    Parameters

    • groups: [string, string][]

      An array of arrays of strings. The inner arrays must have the shape: [groupID, groupName].

    Returns CommandRegistry

    This command registry.

    Throws

    Throws if any groupID is already registered.

    Emits

    client#groupRegistered

Generated using TypeDoc