Quick Start

Run Your Bot Locally

Ensure Docker is installed and running (highly recommended).

  1. Create a directory structure to house your bot's config:

     ./config/
     ├── rules/
     │   └── hello.yml
     └── bot.yml
    

    Create the following files in the specified paths:

    config/bot.yml

    name: mybot
    cli: true
    

    config/rules/hello.yml

    # metadata
    name: hello
    active: true
    respond: hello
    format_output: "what's up?" # message to send to your user when they say hello
    direct_message_only: false
    help_text: hello
    include_in_help: true
    
  2. Run and exec into the bot's container: docker run -it --rm --name mybot -v "$PWD"/config:/config target/flottbot:latest /bin/sh -c "./flottbot"

* Note: Alternatively, you can download the binary for your operating system from the flottbot release page into the cloned repository's directory and execute it there. Basically, just replace step #3 from above with executing the binary, i.e. ./flottbot.

* Note: The container will run with as the unprivileged flottbot user with uid 900. The config directory and files must be readable by that uid. You can change the user using the --user option to docker but it is recommended that you don't run the service as root.

The bot will start locally and you can interact with it via command line. Hit Enter, type hello and hit Enter again.

You should see your bot reply as follows:

mybot> what's up?

Congratulations! You just interacted with your bot via CLI mode. As you saw, you set up your first rule responds to hello (see rule in config/rules/hello.yml).

About CLI Mode

CLI mode runs your bot locally on your machine and doesn't connect to any chat services. It's great for testing simple rules while you are building out your bot. Just keep in mind that there is no concept of rooms/channels when interacting with your bot in CLI mode.

You can disable CLI mode at any time by modifying your /config/bot.yml file, setting the cli: true to cli: false.

Supported Configuration Formats

Although we recommend using YAML, we are using spf13/viper which allows you to use multiple formats, including JSON, TOML, YAML, HCL, and Java properties files. See the config-example directory in the flottbot project for some examples.