File tree Expand file tree Collapse file tree 3 files changed +33
-10
lines changed
Expand file tree Collapse file tree 3 files changed +33
-10
lines changed Original file line number Diff line number Diff line change 22crontable = []
33outputs = []
44
5- #crontable.append([.5,"add_number"])
65crontable .append ([5 ,"say_time" ])
76
87def say_time ():
9- outputs .append (["D030GJLM2" , time .time ()])
8+ #NOTE: you must add a real channel ID for this to work
9+ outputs .append (["D12345678" , time .time ()])
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ outputs = []
2+ crontabs = []
3+
4+ tasks = {}
5+
6+ def process_message (data ):
7+ global tasks
8+ channel = data ["channel" ]
9+ text = data ["text" ]
10+ #only accept tasks on DM channels
11+ if channel .startswith ("D" ) or channel .startswith ("C" ):
12+ if channel not in tasks .keys ():
13+ tasks [channel ] = []
14+ #do command stuff
15+ if text .startswith ("todo" ):
16+ tasks [channel ].append (text [5 :])
17+ outputs .append ([channel , "added" ])
18+ if text == "tasks" :
19+ output = ""
20+ counter = 1
21+ for task in tasks [channel ]:
22+ output += "%i) %s\n " % (counter , task )
23+ counter += 1
24+ outputs .append ([channel , output ])
25+ if text == "fin" :
26+ tasks [channel ] = []
27+ if text .startswith ("done" ):
28+ num = int (text .split ()[1 ]) - 1
29+ tasks [channel ].pop (num )
30+ if text == "show" :
31+ print tasks
You can’t perform that action at this time.
0 commit comments