summaryrefslogtreecommitdiff
path: root/saylol.py
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2014-07-27 19:42:33 +0200
committerjomo <github@jomo.tv>2014-07-27 19:42:33 +0200
commitb1a3a92e49b353dfa42b52b448cdbc3b27bb33f8 (patch)
tree1b135af4f422d2ebcb96e814c08923d52b2f85c3 /saylol.py
parente9b0ad656b71841fa23f332ddf8eff43e5cf1986 (diff)
apply file read/save helpers
Diffstat (limited to 'saylol.py')
-rw-r--r--saylol.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/saylol.py b/saylol.py
index 0b7ccc3..6da18c9 100644
--- a/saylol.py
+++ b/saylol.py
@@ -1,27 +1,15 @@
-import json
from time import time
from helpers import *
from random import randrange
-lol_filename = "plugins/redstoner-utils.py.dir/files/lol.json"
-lols = []
-timeout = 15
-last_msg = 0
-
-try:
- lols = json.loads(open(lol_filename).read())
-except Exception, e:
- error("Failed to load lols: %s" % e)
+lols = open_json_file("lol", [])
+timeout = 15
+last_msg = 0
def save_lols():
- try:
- lolfile = open(lol_filename, "w")
- lolfile.write(json.dumps(lols))
- lolfile.close()
- except Exception, e:
- error("Failed to write lols: " + str(e))
+ save_json_file("lol", lols)
def add_lol(txt):