Skip to content

Commit ddabcfa

Browse files
committed
todo example persists data now
1 parent 8cd6b04 commit ddabcfa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/example-plugins/todo.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
import os
2+
import pickle
3+
14
outputs = []
25
crontabs = []
36

47
tasks = {}
58

9+
FILE="plugins/todo.data"
10+
if os.path.isfile(FILE):
11+
tasks = pickle.load(open(FILE, 'rb'))
12+
613
def process_message(data):
714
global tasks
815
channel = data["channel"]
@@ -29,3 +36,4 @@ def process_message(data):
2936
tasks[channel].pop(num)
3037
if text == "show":
3138
print tasks
39+
pickle.dump(tasks, open(FILE,"wb"))

0 commit comments

Comments
 (0)