-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsandwich.py
22 lines (20 loc) · 862 Bytes
/
sandwich.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import facebook
import serial
import time
ser = serial.Serial('/dev/ttyACM0', 9600)
ser.write('0')
access_token = '201793946507565%7Cd202ecd7aef8dbce66e1e6e0-100002268818038%7CiHYYQSxjEu1_O2cltKLULG-7jL8' # LifeOf TheParty
event_id = '130842913653732' # Hackathon
graph = facebook.GraphAPI(access_token)
while 1:
posts = graph.get_connections('me', 'feed')['data']
last_status = posts[0]
if last_status['message'].find('Make me a sandwich.') != -1 and last_status['id'] != last_id:
message = "What? Make it yourself."
graph.put_object(last_status['id'], "comments", message=message)
elif last_status['message'].find('Sudo make me a sandwich.') != -1 and last_status['id'] != last_id:
message = "Okay."
graph.put_object(last_status['id'], "comments", message=message)
ser.write('180')
last_id = last_status['id']
time.sleep(5)