/python-slackbot

Bot Framework for Slack

Primary LanguagePythonMIT LicenseMIT

python-slackbot

A Slack bot written in python that allows for two way communication.

Originally forked from https://github.com/slackhq/python-rtmbot, python-slackbot is the simplest way to build a Bot user for Slack. Unlike python-rtmbot, this repo has full support for messages with UTF-8 characters and automatic reconnects.

Example Arnold Bot

from slackbot import SlackBot
import random

def arnold(client, event):
    # Ignore what the user said, simply generate random arnold quote
    quotes = [u"Milk is for babies. When you grow up you have to drink beer.",
              u"Start wide, expand further, and never look back.",
              u"If it bleeds, we can kill it."]
    return random.choice(quotes)


token = 'SLACK TOKEN HERE'
my_bot = SlackBot(token, arnold)
my_bot.start()

Dependencies