Options
All
  • Public
  • Public/Protected
  • All
Menu

Utility in charge of holding and running commands

Hierarchy

  • CommandHandler

Index

Constructors

constructor

Properties

CommandContext

CommandContext: typeof CommandContext = ...

SlashCommandContext

SlashCommandContext: typeof SlashCommandContext = ...

Optional commands

commands: Collection<CommandType, CommandOptions>

middlewares

middlewares: MiddlewareFunction[] = []

Optional prefixFunction

prefixFunction: (message: APIMessage) => string | string[] | Promise<string | string[]>

Type declaration

    • (message: APIMessage): string | string[] | Promise<string | string[]>
    • Parameters

      • message: APIMessage

      Returns string | string[] | Promise<string | string[]>

Methods

add

error

errorFunction

  • errorFunction(ctx: CommandContext, err: CommandError): void

find

  • find(command: string, interaction?: boolean): undefined | CommandOptions

findCommand

load

middleware

options

prefix

  • prefix(fn: string | string[] | ((message: APIMessage) => string | string[] | Promise<string | string[]>)): CommandHandler
  • Sets a prefix

    example

    worker.commands .prefix('!') // or .prefix(['!', '+']) // or .prefix((message) => { return db.getPrefix(message.guild_id) })

    Parameters

    • fn: string | string[] | ((message: APIMessage) => string | string[] | Promise<string | string[]>)

      String of prefix or Function to choose prefix with

    Returns CommandHandler

    this

setPrefix

  • setPrefix(fn: string | string[] | ((message: APIMessage) => string | string[] | Promise<string | string[]>)): CommandHandler

setupInteractions

  • setupInteractions(): Promise<void>

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Static method

Generated using TypeDoc