HelpMessages - 18F/charlie GitHub Wiki

Charlie developer documentation > Help messages

The help messages utiilty provides a way for bots to register help messages about themselves. These messages are then available from the utility's getHelp method. The help bot uses this utility to assemble the help message it sends to users in response to the @Charlie help command.

Bots that users will interact with directly, regardless of how the bot is triggered, should register themselves with help messages to make them more discoverable and to help users know how to use them.

The help messages utility recognizes two kinds of bots: interactive and non-interactive. "Interactive" bots are those that are triggered intentionally by user action, such as the QEX expander or glossary. Noninteractive bots are those that respond passively, such as Inclusion Bot or Optimistic Tock. The help bot displays them in separate sections and renders them differently, so it's useful to register your bot appropriately.

function getHelp()

Gets the collection of bots that have been registered with help messages, split up according to what type they registered as.

Returns

  • A Map whose keys are the types of bots (using the Symbols defined in the type property) and whose values are lists of the bots registered for each type.

    The bots are objects whose schema varies depending on what type it registered as. Interactive bots have name, trigger, helpText, and directMention properties. Noninteractive bots have name and helpText properties only.

    E.g.:

    new Map([
      [
        Symbol(interactive),
        [
          {
            name: "bot 1",
            trigger: "trigger 1",
            helpText: "what this bot is for",
            directMention: false,
          },
          {
            name: "bot 2",
            trigger: "trigger 2",
            helpText: "what this bot is for",
            directMention: true,
          },
        ],
      ],
      [
        Symbol(nontinteractive),
        [
          {
            name: "bot 3",
            helpText: "what this bot is for",
          },
        ],
      ],
    ]);

function registerInteractive(String name, String trigger, String helpText, Bool directMention)

Register an interactive bot with the help utility. This is for bots that are triggered directly by user action.

Argument Description
name The name of the bot.
trigger How the bot is triggered. This should be simple. If the bot can be triggered multiple ways, consider either supplying only the simplest trigger OR registering the bot multiple times with each trigger.
helpText A description of what the bot does and/or how to use it. Most of the current bots' help text is lighthearted and descriptive.
directMention Whether this bot can only be triggered by @-messaging the bot.

Default: false

function registerNonInteractive(String name, String helpText)

Register a noninteractive bot with the help utility. This is for bots that users either cannot or usually do not trigger intentionally.

Argument Description
name The name of the bot.
helpText A description of what the bot does and/or how to use it. Most of the current bots' help text is lighthearted and descriptive.

property type

An object containing the types of messages that the help message utility understands. The values are symbols so they are immutable. This is generally only useful in conjunction with getHelp().

Value Description
interactive The symbol representing help entries for interactive bots
noninteractive The symbol representing help entries for non-interactive bots
⚠️ **GitHub.com Fallback** ⚠️