-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.py
31 lines (29 loc) · 1.37 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import time
from slackclient import SlackClient
from chatterbot import ChatBot
chatbot = ChatBot("dude")
chatbot.train("biglebowskiscript")
token = "SLACK TOKEN GOES HERE"
sc = SlackClient(token)
if sc.rtm_connect():
my_user_id = sc.server.users.find(sc.server.username).id
while True:
messages = sc.rtm_read()
try:
for message in messages:
if message['type'] == 'message':
if 'am i wrong?' in message['text'].lower():
sc.rtm_send_message(message['channel'], "You're not wrong <@%s>, you're just an asshole." % message['user'])
if 'vietnam' in message['text'].lower():
response = "God damn you Walter! You f***in' asshole! Everything's a f***in' travesty with you, man! And what was all that shit about Vietnam? What the FUCK, has anything got to do with Vietnam? What the f*** are you talking about?"
sc.rtm_send_message(message['channel'], response)
if my_user_id in message['text']:
response = chatbot.get_response(message['text'])
sc.rtm_send_message(message['channel'], response)
except:
print messages
print messages
# print sc.server.users.find('dude')
time.sleep(1)
else:
print "Connection Failed, invalid token?"