Guide: Blacklists and Whitelists

June 3, 2020 by @devth

Yetibot exposes a plethora of commands ranging from weather and wolfram lookups to meme generation to stock prices to simple text manipulation and much more. Some operators may not want to expose the full range of Yetibot capabilities to their users, whether for security, or simplicity, or other reasons.

help
!help on a Yetibot with many aliases and all commands enabled

Now operators can intentionally expose any subset of Yetibot that they'd like via config. Thanks to @gkspranger for helping us work through this by providing lots of thoughtful feedback and feature requests! PRs that enabled these changes are:

Configuration

When whitelist is configured, all commands are disabled except those present in the whitelist collection, plus any foundational commands. Example config:

:yetibot-command-whitelist-0 "echo"
:yetibot-command-whitelist-1 "list"

help
!help on a Yetibot with a whitelist allowing only echo and list

When blacklist is configured, all commands are enabled except those present in the blacklist collection, plus any foundational commands. Example config:

:yetibot-command-blacklist-0 "echo"
:yetibot-command-blacklist-1 "list"

help
!help on a Yetibot with a blacklist disabling echo and list

Foundational commands

We intentionally excluded a few commands from whitelists and blacklists as they are foundational or could be considered meta commands:

  1. help - meta command that lets users know which commands are available, and how each command works.
  2. alias - aliases are all about composing or parameterizing other commands.
  3. channel - command for working with channel-specific settings.
  4. category - meta command for working with available commands according to their category.

Customized fallback command

Related to curating the set of available commands, we can also configure the fallback command (i.e. what happens when a user tries to run a command that doesn't exist). This example sets it to an alias:

:yetibot-default-command "custom"

help
!help on a Yetibot with fallback set to a custom alias

Customized fallback help docs

In the previous section, notice the output of !help includes:

✅ Fallback commands are enabled, and the default command is custom. This is triggered when a user enters a command that does not exist, and passes whatever the user entered as args to the fallback command.

This is the default snippet of help text for fallback commands, but this too is overridable:

:yetibot-command-fallback-help-text "Welcome to Yetibot 👋"

help
!help on a Yetibot with custom fallback help text

ops guide 2020