A framework for Slack RTM bots.
Project description
This library provides a simple asyncio based interface for writing RTM <https://api.slack.com/rtm> bots for Slack. Many distinct functions can be run through a single Slack bot plugin, triggered by user defined commands (e.g. !myCommand).
Example
A bot which can be triggered by the message !greet Guido looks like this:
from asyncbots.bot import SlackBot, register
from asyncbots.command import MessageCommand
from pyparsing import alphas, Word
class MyBot(SlackBot)
def __init__(self):
self.name = 'My Bot'
# Match 'greet' followed by any word
self.expr = 'greet' + Word(alphas).setResultsName('user')
@register()
async def handler(self, sender, channel, parsed_message):
return MessageCommand('Hello ' + parsed_message['user'])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asyncbots-0.1.5.tar.gz
(13.2 kB
view hashes)
Built Distribution
asyncbots-0.1.5-py3-none-any.whl
(16.8 kB
view hashes)
Close
Hashes for asyncbots-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a33df8c99cb8a6a1c970e7ee418c00d3cf478913a15734019047b64f7e06dc0 |
|
MD5 | b61c875461ea78a4f09abfabbd71608a |
|
BLAKE2b-256 | 2132774df3d44850d02a2887931e7915ec2bd6bc60e2b2727ee296a6a5a84851 |