-
Notifications
You must be signed in to change notification settings - Fork 3
/
chatbot.py
34 lines (24 loc) · 922 Bytes
/
chatbot.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
32
33
34
#! /usr/bin/python
import time
import ConfigParser
import random
import groupme
auth = groupme.auth()
token = auth.request_token()
interact = groupme.interact(token)
config = ConfigParser.ConfigParser()
config.read('keys.cfg')
keys = config.items('groups')
phrases = ['ponys.', 'no pizza', 'out of coffee', 'The saddest thing is a homeless man winning the lottery and spending all the money on charities that are fronts for drug smuggling.']
answers = ['hard to tell', 'ask again later', 'TITS OR GTFO', 'how dare you.', 'I will dance on your grave']
current = ''
while True:
name, text = interact.last_line(1469199)
if current != str(text):
print str(name),': ',str(text)
current = str(text)
if current == 'Timeboat, what is the saddest thing?':
interact.post_line(1469199, random.choice(phrases))
elif current[:8] == 'Timeboat':
interact.post_line(1469199, random.choice(answers))
time.sleep(0.5)