Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Router

Hierarchy

  • Router

Index

Constructors

Properties

_bot: Bot
errorAction: ActionObject
handler: CommandsHandler = ...
options: RouterOptions
parent: undefined | Router = undefined
trigger: undefined | string = undefined
typoAction: undefined | TypoAction = undefined
typoOptions: undefined | TypoOptions = undefined

Methods

  • compileAll(nesting?: number): CommandCollection
  • Parameters

    • nesting: number = 0

    Returns CommandCollection

  • findAction(content: string): undefined | RoutedAction
  • Parameters

    • content: string

    Returns undefined | RoutedAction

  • findOnTypo(): undefined | [TypoAction, TypoOptions]
  • Returns undefined | [TypoAction, TypoOptions]

  • fullTrigger(): string[]
  • isGlobal(): boolean
  • on<T>(trigger: string | RegExp | string[], action: T, parameters?: T extends Router ? never : undefined | { description?: string; name: string; type?: "SUB_COMMAND" | "SUB_COMMAND_GROUP" | "STRING" | "INTEGER" | "BOOLEAN" | "USER" | "CHANNEL" | "ROLE" | "MENTIONABLE" | "NUMBER" }[]): Router
  • Creates a new action that the bot will react to. Replaces the now deprecated registerAction

    Type parameters

    Parameters

    • trigger: string | RegExp | string[]

      Name of the trigger

    • action: T

      Action to perform on this command

    • Optional parameters: T extends Router ? never : undefined | { description?: string; name: string; type?: "SUB_COMMAND" | "SUB_COMMAND_GROUP" | "STRING" | "INTEGER" | "BOOLEAN" | "USER" | "CHANNEL" | "ROLE" | "MENTIONABLE" | "NUMBER" }[]

      Parameters to be registered for slash command, defaults to [{name: "arguments", type: "STRING"}]

    Returns Router

  • onTypo(action: TypoAction, options?: TypoOptions): Router
  • Parameters

    • action: TypoAction
    • Optional options: TypoOptions

    Returns Router

  • padAction(action: Router): Router
  • padAction(action: ActionObject | ResponseAction, parameters?: { description?: string; name: string; type?: "SUB_COMMAND" | "SUB_COMMAND_GROUP" | "STRING" | "INTEGER" | "BOOLEAN" | "USER" | "CHANNEL" | "ROLE" | "MENTIONABLE" | "NUMBER" }[]): ActionObject
  • Parameters

    Returns Router

  • Parameters

    • action: ActionObject | ResponseAction
    • Optional parameters: { description?: string; name: string; type?: "SUB_COMMAND" | "SUB_COMMAND_GROUP" | "STRING" | "INTEGER" | "BOOLEAN" | "USER" | "CHANNEL" | "ROLE" | "MENTIONABLE" | "NUMBER" }[]

    Returns ActionObject

  • removeAction(trigger: string | RegExp | string[]): undefined | string | RegExp
  • Parameters

    • trigger: string | RegExp | string[]

    Returns undefined | string | RegExp

  • report(...stuff: any[]): void
  • Parameters

    • Rest ...stuff: any[]

    Returns void

  • turnArrayToRegex(trigger: string[]): RegExp
  • Parameters

    • trigger: string[]

    Returns RegExp

Generated using TypeDoc