Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

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


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
asyncbots-0.1.8.linux-x86_64.tar.gz (27.9 kB) Copy SHA256 hash SHA256 Source None Aug 17, 2018
asyncbots-0.1.8-py3-none-any.whl (15.6 kB) Copy SHA256 hash SHA256 Wheel py3 Aug 17, 2018

Supported by

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