Options
Modules
  • Command
  • Localization
  • Logger
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • CommandModule

Index

Constructors

constructor

Properties

Static commands

commands: typeof CommandCache = ...

Holds all commands

Static meta

meta: Map<string, any> = ...

A metadata cache used by the command module for tracking internal things. Can be used for anything

Static resolvers

resolvers: typeof ResolverCache = ...

Holds all argument resolvers

Static rules

rules: typeof RuleCache = ...

Holds all command module rules. Rules are run for all commands

Methods

Static enforcePrefixes

  • enforcePrefixes(): void
  • Tells the command module to enforce usage of prefixes in commands. This will prevent commands from running if some rule does not set MessageContext.prefixUsed to true (presumably because a prefix was used)

    NOTE: The checkMentionPrefix rule will call this automatically when it is run. If you write your own prefix rule, be sure to call this somewhere within the rule function

    Returns void

Static finalizeCommandArgBindings

  • finalizeCommandArgBindings(): void
  • Finalize argument bindings for all loaded commands. Should be called at any point after all desired commands have been loaded but before commands are allowed to be run (e.g. before calling <Client>#login())

    Returns void

Static getGlobalErrorHandler

Static registerClient

  • registerClient(client: Client): void
  • Register your client instance with the command module. This will initialize all loaded commands and register the client with the Command dispatcher once the client emits the ready event

    Parameters

    • client: Client

    Returns void

Static registerGlobalErrorHandler

  • Sets the global error handler that will be used for handling Rule errors and any middleware/command errors that are not handled by individual Command error handling methods.

    If called without an ErrorHandler argument, a blank error handler will be generated and cached. You can fetch it with getGlobalErrorHandler to append/override error matchers at a later time.

    Global error handlers will be given a MessageContext or CommandContext object if the error being given is from Rules or Middleware respectively. Additionally, a CommandContext object will be given if an error is thrown during argument parsing, resolving, or if there was an uncaught error in a command action. You can reasonably expect the context objects to be present for the following error types:

    Parameters

    Returns void

Generated using TypeDoc