Poursuite de http://qiita.com/attakei/items/29b3f0086296345216df
Cette fois, je vais essayer la construction initiale d'Errbot qui surveille Slack et fonctionne.
config.py
#Près de L47
#Spécifiez le back-end de la discussion. Cette fois, spécifiez Slack ici
BACKEND = 'Slack'  # defaults to XMPP
#Près de L135
 BOT_IDENTITY = {
     #Commentez la partie XMPP
     # 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
#Près de L152
    #Vous avez besoin d'un jeton pour utiliser Slack, spécifiez donc le jeton mis en commentaire.
    # Slack mode (comment the others above if using this mode)
    'token': 'xoxb-your-slack-token',
#Près de L179
#Une liste de comptes disposant de privilèges administratifs pour cet Errbot.@Celui qui part de
BOT_ADMINS = ()
#Près de L185
#Les salles et canaux auxquels participe cet Errbot. Cette fois, je vais parler seul si vide taple
CHATROOM_PRESENCE = ()
Au terminal
$ errbot
12:34:47 INFO     errbot.err                Config check passed...
12:34:47 INFO     errbot.err                Selected backend 'Slack'.
(Abréviation)
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
(Abréviation)
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
Il se connecte à l'API de messagerie de slack.

Côté terminal
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
En regardant le journal, "à partir de qui" et "quelle commande" est sorti.
Après cela, si vous le mettez quelque part comme heroku, le chatbot est terminé
Recommended Posts