Options
All
  • Public
  • Public/Protected
  • All
Menu

A library of related dialogs used for routing purposes. Libraries can be chained together to enable the development of complex bots. The UniversalCallBot class is itself a Library that forms the root of this chain.

Libraries of reusable parts can be developed by creating a new Library instance and adding dialogs just as you would to a bot. Your library should have a unique name that corresponds to either your libraries website or NPM module name. Bots can then reuse your library by simply adding your parts Library instance to their bot using UniversalCallBot.library(). If your library itself depends on other libraries you should add them to your library as a dependency using Library.library(). You can easily manage multiple versions of your library by adding a version number to your library name.

To invoke dialogs within your library bots will need to call session.beginDialog() with a fully qualified dialog id in the form of ':'. You'll typically hide this from the devloper by exposing a function from their module that starts the dialog for them. So calling something like myLib.someDialog(session, { arg: '' }); would end up calling session.beginDialog('myLib:someDialog', args); under the covers.

Its worth noting that dialogs are always invoked within the current dialog so once your within a dialog from your library you don't need to prefix every beginDialog() call your with your libraries name. Its only when crossing from one library context to another that you need to include the library name prefix.

Hierarchy

  • Library

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Library(name: string): Library

Properties

name

name: string

Unique name of the library.

Methods

dialog

  • Registers or returns a dialog from the library.

    Parameters

    • id: string

      Unique ID of the dialog being regsitered or retrieved.

    • Optional dialog: Dialog | IDialogWaterfallStep[] | IDialogWaterfallStep

      (Optional) dialog or waterfall to register.

      • dialog: {Dialog} - Dialog to add.
      • dialog: {IDialogWaterfallStep[]} - Waterfall of steps to execute. See IDialogWaterfallStep for details.
      • dialog: {IDialogWaterfallStep} - Single step waterfall. Calling a built-in prompt or starting a new dialog will result in the current dialog ending upon completion of the child prompt/dialog.

    Returns Dialog

findDialog

  • findDialog(libName: string, dialogId: string): Dialog
  • Searches the library and all of its dependencies for a specific dialog. Returns the dialog if found, otherwise null.

    Parameters

    • libName: string

      Name of the library containing the dialog.

    • dialogId: string

      Unique ID of the dialog within the library.

    Returns Dialog

library

  • Registers or returns a library dependency.

    Parameters

    • lib: Library | string
      • lib: {Library} - Library to register as a dependency.
      • lib: {string} - Unique name of the library to lookup. All dependencies will be searched as well.

    Returns Library

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method