From ddabcfa8e177fd54a8802f6b13294e17543e999e Mon Sep 17 00:00:00 2001 From: Ryan Huber Date: Fri, 21 Nov 2014 21:25:27 -0800 Subject: [PATCH] todo example persists data now --- doc/example-plugins/todo.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/example-plugins/todo.py b/doc/example-plugins/todo.py index dea6e0f..616be49 100644 --- a/doc/example-plugins/todo.py +++ b/doc/example-plugins/todo.py @@ -1,8 +1,15 @@ +import os +import pickle + outputs = [] crontabs = [] tasks = {} +FILE="plugins/todo.data" +if os.path.isfile(FILE): + tasks = pickle.load(open(FILE, 'rb')) + def process_message(data): global tasks channel = data["channel"] @@ -29,3 +36,4 @@ def process_message(data): tasks[channel].pop(num) if text == "show": print tasks + pickle.dump(tasks, open(FILE,"wb"))