Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Bit

A single interaction between user and bot. Could be a command to trigger a callback, a request for data or just a connecting line of dialogue.

Hierarchy

  • Bit

Implements

Indexable

[key: string]: any

Index signature for looping through attributes

Index

Constructors

constructor

  • Define a condition or intent that executes the bit. Define a condition or intent that executes the bit.

    A subsequent bit can even lead back to its own parent or any other bit, creating a mesh of possible conversational pathways.

    A bit without a condition or intent can still be executed by calling doBit with its id. This could be useful for defining integration logic that does something outside chat, but can be triggered by chat scripts.

    A subsequent bit can even lead back to its own parent or any other bit, creating a mesh of possible conversational pathways.

    A bit without a condition or intent can still be executed by calling doBit with its id. This could be useful for defining integration logic that does something outside chat, but can be triggered by chat scripts.

    Parameters

    Returns Bit

Properties

Optional callback

callback: ICallback

Function to call when executing bit (after any defined sends)

Optional catch

catch: undefined | string

To send if response unmatched by branch

Optional catchCallback

catchCallback: ICallback

Function to call when response unmatched by branch

Optional condition

condition: RegExp | string

Regex or string converted to regex for branch to trigger bit

id

id: string

For scene and/or dialogue, branch running the bit (required)

Optional intent

intent: undefined | string

Key for language processed intent to match for execution

Optional next

next: string | string[]

Key/s (strings) for consecutive bits (implicitly creates scene)

Optional options

options: undefined | string

Key/val options for scene and/or dialogue config

Optional send

send: string | string[]

String/s to send when doing bit (must have this or callback)

Methods

run

  • run(b: State): Promise<void>
  • Execute with current state (e.g. send replies and/or call callbacks).

    Parameters

    Returns Promise<void>

Generated using TypeDoc