Continuation of http://qiita.com/attakei/items/29b3f0086296345216df
This time I will try to initially build an Errbot that monitors Slack and works.
config.py
#Near L47
#Specify the chat backend. This time specify Slack here
BACKEND = 'Slack' # defaults to XMPP
#Near L135
BOT_IDENTITY = {
#Comment out the XMPP part
# XMPP (Jabber) mode
# 'username': 'err@localhost', # The JID of the user you have created for the bot
# 'password': 'changeme', # The corresponding password for this user
#Near L152
#You need a token to use Slack, so specify the token that is commented out
# Slack mode (comment the others above if using this mode)
'token': 'xoxb-your-slack-token',
#Near L179
#A list of accounts that have administrative privileges for this Errbot.@The one who starts from
BOT_ADMINS = ()
#Near L185
#The rooms and channels in which this Errbot participates. This time I will talk alone so empty tuples
CHATROOM_PRESENCE = ()
At the terminal
$ errbot
12:34:47 INFO errbot.err Config check passed...
12:34:47 INFO errbot.err Selected backend 'Slack'.
(Abbreviation)
12:34:48 INFO errbot.main Found Backend plugin: 'Slack'
12:34:48 INFO errbot.backends.slack Verifying authentication token
12:34:50 INFO requests.packages.urllib3 Starting new HTTPS connection (1): slack.com
12:34:52 INFO errbot.backends.slack Connecting to Slack real-time-messaging API
12:34:52 INFO requests.packages.urllib3 Starting new HTTPS connection (1): slack.com
12:34:56 INFO errbot.backends.slack Connected
(Abbreviation)
12:34:57 INFO errbot.errBot
12:34:57 INFO errbot.errBot Notifying connection to all the plugins...
12:34:57 INFO errbot.plugins.ChatRoom Callback_connect
12:34:57 INFO errbot.errBot Plugin activation done.
12:34:58 INFO requests.packages.urllib3 Starting new HTTPS connection (1): slack.com
It connects to slack's messaging API.
Terminal side
13:05:04 INFO errbot.plugins.ACLS Matching ACL {} against username @attakei for command Help:help
13:05:04 INFO errbot.plugins.ACLS Check if help is admin only command.
13:05:04 INFO errbot.errBot Processing command 'help' with parameters '' from @attakei
Looking at the log, "from whom" and "what command" is output.
After that, if you put it somewhere on heroku, the chatbot is completed
Recommended Posts