Create, configure, and handle a command.

Constructors

Properties

Permissions of the command.

Methods

  • Add arguments to the command via template syntax. This method is a template tag, and is used differently than a normal function. If you want to add arguments via a normal function, use Command#options() instead.

    The custom syntax is as follows:

    // With square brackets, you can
    // add an optional argument:
    command.args`[${arg}]`

    // With less/greater than signs, you can
    // add a required argument:
    command.args`<${arg}>`

    // With nothing surrounding it, you can
    // add subcommands and subgroups:
    command.args`${subgroup} ${subcommand} <${arg}>`

    // Add multiple arguments at once:
    command.args`<${arg1}> <${arg2}> [${arg3}]`

    Parameters

    Returns Command

  • Set custom properties for the command. Useful for features Discord may add in the future that aren't immediately given direct support in @brynjolf/commands.

    Parameters

    • customProperty: string
    • value: any

    Returns Command

  • Set localized descriptions for the command.

    Parameters

    • descs: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

    Returns Command

  • Set localized names for the command.

    Parameters

    • names: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", null | string>>

    Returns Command

  • The non-template equivalent of Command#args(). Add arguments to the command without the terseness of template syntax.

    The usage is as follows:

    // Add an argument:
    command.options(arg)

    // Add multiple arguments at once:
    command.options(subcommand, arg1, arg2)

    Parameters

    Returns Command

    Remarks

    Note: this requires arguments created with opts to define the req property to determine if they are required.

Generated using TypeDoc