Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A bot that is also a responsive shell

Project description

Fast, simple and lightweight micro bot framework for Python. It is distributed as a single package and has very few dependencies other than the Python Standard Library. Shellbot supports Python 3 and Python 2.7. Test coverage exceeds 90%.

  • Channels: a single bot can access jointly group and direct channels
  • Commands: routing from chat box to function calls made easy, including support of file uploads
  • State machines: powerful and pythonic way to bring intelligence to your bot
  • Stores: each bot has a dedicated data store
  • Utilities: convenient configuration-driven approach, chat audit, and more
  • Platforms: Cisco Spark, local disconnected mode for tests – looking for more

The Batman example

import os
import time

from shellbot import Engine, Context, Command

class Batman(Command):  # a command that displays static text
    keyword = 'whoareyou'
    information_message = u"I'm Batman!"

class Batcave(Command):  # a command that reflects input from the end user
    keyword = 'cave'
    information_message = u"The Batcave is silent..."

    def execute(self, bot, arguments=None, **kwargs):
        if arguments:
            bot.say(u"The Batcave echoes, '{0}'".format(arguments))

class Batsignal(Command):  # a command that uploads a file/link
    keyword = 'signal'
    information_message = u"NANA NANA NANA NANA"
    information_file = ""

    def execute(self, bot, arguments=None, **kwargs):

class Batsuicide(Command):  # a command only for group channels
    keyword = 'suicide'
    information_message = u"Go back to Hell"
    in_direct = False

    def execute(self, bot, arguments=None, **kwargs):

engine = Engine(  # use Cisco Spark and load shell commands
    commands=[Batman(), Batcave(), Batsignal(), Batsuicide()])

os.environ['BOT_ON_ENTER'] = 'You can now chat with Batman'
os.environ['BOT_ON_EXIT'] = 'Batman is now quitting the room, bye'
os.environ['CHAT_ROOM_TITLE'] = 'Chat with Batman'
engine.configure()  # ensure that all components are ready  # create a group channel for this example  # until Ctl-C
engine.dispose()  # delete the initial group channel

Quick installation

To install the shellbot package, type:

$ pip install shellbot

Or, if you prefer to download the full project including examples and documentation, and install it, do the following:

$ git clone
$ cd shellbot
$ pip install -e .

Where do you want to start?

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
shellbot-17.10.20-py2.py3-none-any.whl (125.9 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Oct 20, 2017
shellbot-17.10.20.tar.gz (195.6 kB) Copy SHA256 hash SHA256 Source None Oct 20, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page