todo example persists data now
This commit is contained in:
parent
8cd6b04053
commit
ddabcfa8e1
1 changed files with 8 additions and 0 deletions
|
|
@ -1,8 +1,15 @@
|
||||||
|
import os
|
||||||
|
import pickle
|
||||||
|
|
||||||
outputs = []
|
outputs = []
|
||||||
crontabs = []
|
crontabs = []
|
||||||
|
|
||||||
tasks = {}
|
tasks = {}
|
||||||
|
|
||||||
|
FILE="plugins/todo.data"
|
||||||
|
if os.path.isfile(FILE):
|
||||||
|
tasks = pickle.load(open(FILE, 'rb'))
|
||||||
|
|
||||||
def process_message(data):
|
def process_message(data):
|
||||||
global tasks
|
global tasks
|
||||||
channel = data["channel"]
|
channel = data["channel"]
|
||||||
|
|
@ -29,3 +36,4 @@ def process_message(data):
|
||||||
tasks[channel].pop(num)
|
tasks[channel].pop(num)
|
||||||
if text == "show":
|
if text == "show":
|
||||||
print tasks
|
print tasks
|
||||||
|
pickle.dump(tasks, open(FILE,"wb"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue