Shellbot: Python Chat Bot Framework
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
Context.set_logger()
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))
else:
bot.say(self.information_message)
class Batsignal(Command): # a command that uploads a file/link
keyword = 'signal'
information_message = u"NANA NANA NANA NANA"
information_file = "https://upload.wikimedia.org/wikipedia/en/c/c6/Bat-signal_1989_film.jpg"
def execute(self, bot, arguments=None, **kwargs):
bot.say(self.information_message,
file=self.information_file)
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):
bot.say(self.information_message)
bot.dispose()
engine = Engine( # use Cisco Spark and load shell commands
type='spark',
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
engine.bond(reset=True) # create a group channel for this example
engine.run() # 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 https://github.com/bernard357/shellbot.git $ cd shellbot $ pip install -e .
Where do you want to start?
Documentation: Shellbot at ReadTheDocs
Python package: Shellbot at PyPi
Source code: Shellbot at GitHub
Free software: Apache License (2.0)
Credits
securitybot from the Dropbox team
Metadata
Release files for shellbot 17.10.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shellbot-17.10.20.tar.gz | 195.6 kB | Without provenance | Details for shellbot-17.10.20.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shellbot-17.10.20-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for shellbot-17.10.20-py2.py3-none-any.whl |
Total release size: 321.4 kB
Release files / shellbot-17.10.20.tar.gz
| Download URL | shellbot-17.10.20.tar.gz |
|---|---|
| Size | 195.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09accfdd214a134b43e68cec15b0118e2d32a30917a192bffaf29b74d76ebe08
|
|
BLAKE2b-256 checksum How to use checksums |
011c4355a57ed0bf1d20adbb2ee7396d2bee3928316c3d7db6af062c3d37b24d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / shellbot-17.10.20-py2.py3-none-any.whl
| Download URL | shellbot-17.10.20-py2.py3-none-any.whl |
|---|---|
| Size | 125.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
09e59203f31142fc1d4e7e36ddd249aa350869da341c6d42f7073768ac2f2a63
|
|
BLAKE2b-256 checksum How to use checksums |
d1e47ba0534a75c44d82d1f70ca8e71e5c86b697d93727d54479e730deb1fc71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for shellbot 17.10.20
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.