Options
All
  • Public
  • Public/Protected
  • All
Menu

The Bot object, pass in a Discord API token and set the options according to your needs. Note that you're required to set either a prefix and/or a suffix

Hierarchy

  • BotBase
    • Bot

Index

Constructors

  • new Bot(token: string, options: BotOptions): Bot
  • Parameters

    • token: string
    • options: BotOptions

    Returns Bot

Properties

Action: typeof Action
client: Client<boolean>

Discord.js client object

commands: SlashCommands = ...
compileCommands: (nesting?: number) => CommandCollection

Type declaration

    • (nesting?: number): CommandCollection
    • Parameters

      • nesting: number = 0

      Returns CommandCollection

componentHandler: ComponentHandler
embed: Embed

The embed object used for creating embeds in your actions

id: number
ignoreCaps: boolean

The bot will automatically ignore caps on the trigger keyword if enabled

middlewareArray: ParametersMiddleWare<any>[] = []
name: undefined | string = undefined
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

Type declaration

    • <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

onDefault: (action: ActionObject | ResponseAction) => Router

Type declaration

onError: (action: ActionObject | ResponseAction) => Router

Type declaration

onTypo: (action: TypoAction, options?: TypoOptions) => Router

Type declaration

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

      • action: TypoAction

        Callback function to be called if similar commands are found

      • Optional options: TypoOptions

      Returns Router

prefix: undefined | string

The prefix used by your bot

registerAction: <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

Type declaration

    • <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

router: Router
setDefaultAction: (action: ActionObject | ResponseAction) => Router

Type declaration

setErrorAction: (action: ActionObject | ResponseAction) => Router

Type declaration

suffix: undefined | string

The suffix used by your bot

token: string

Methods

  • createParams(msg: Message<boolean> | CommandInteraction<CacheType>, args: undefined | string, parameters: Record<string, undefined | string | number | boolean | User | GuildMember | Role | APIRole>, trigger: string): Promise<ActionParameters<undefined>>
  • Parameters

    • msg: Message<boolean> | CommandInteraction<CacheType>
    • args: undefined | string
    • parameters: Record<string, undefined | string | number | boolean | User | GuildMember | Role | APIRole>
    • trigger: string

    Returns Promise<ActionParameters<undefined>>

  • handleAction(params: ActionParameters<undefined>, routedAction: RoutedAction, invokerId?: undefined | string): Promise<void>
  • Parameters

    • params: ActionParameters<undefined>
    • routedAction: RoutedAction
    • invokerId: undefined | string = undefined

    Returns Promise<void>

  • interactionHandler(interaction: Interaction<CacheType>): Promise<void>
  • Parameters

    • interaction: Interaction<CacheType>

    Returns Promise<void>

  • messageHandler(msg: Message<boolean>): Promise<void>
  • Parameters

    • msg: Message<boolean>

    Returns Promise<void>

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

    • Rest ...stuff: any[]

    Returns void

  • setPresence(activities: [string, PresenceType] | [string, PresenceType][], interval?: number): void
  • Parameters

    • activities: [string, PresenceType] | [string, PresenceType][]
    • interval: number = ...

    Returns void

Generated using TypeDoc