SLAPI: Step By Step Guide

Common Steps

Regardless of how you start the bot, these tasks will be identical

Interact

So you have your bot connected? What do you do now?

Let’s try a few things. (replace @bot with whatever you named your bot)

  • Make sure to invite the Bot to the room you are working in /invite @bot
  • Check that your bot is working - @bot ping
  • See what plugins are installed = @bot help

Hmm, seems like we’re a little bland eh? Let’s try something more advanced.

Get SLAPIN!

The bot is on and it’s responding. Let’s add a little something to it.

Leave the bot running for this whole process, no need to restart it.

  • Take the following code and put it in the file ./config/plugins/hello.yml, this is what we refer to as a Script type plugin.

    plugin:
        type: script
        language: bash
        listen_type: passive
        help:
          world: "Says Hello World!"
        description: "simple hello world"
        write: |
          #!/bin/bash
          if [ "${1}" == 'world' ]; then
              echo 'Hello World!'
          else
              echo 'No World for You!'
          fi
    

Alright! our first plugin, or as we call them. SLAPINS!

Now go back to chat and run the following

  • @bot reload
  • Lets try @bot help again
  • Oh, there’s a plugin now. Lets try it! @bot hello
  • Eh, my bad. Maybe I should read the instructions
  • Lets dig into the help and see what it can do @bot help hello
  • Ahh, so.. it helps to read instructions. Try @bot hello world

What?! How easy was that? The built in reload option will let you add plugins on the fly or update them right from the chat room.

What’s Next?

This is where the step by step ends for now.

We are working on more documentation and plugins to cover.

We will also have a roadmap showing what upcoming and in what order for SLAPI. Until then, kick the tires and think about turning your favorite cli tool into a SLAPIN or make your own from scratch!

See the Plugins section to get started

Tags: framework