diff options
author | jomo <github@jomo.tv> | 2014-07-27 19:42:33 +0200 |
---|---|---|
committer | jomo <github@jomo.tv> | 2014-07-27 19:42:33 +0200 |
commit | b1a3a92e49b353dfa42b52b448cdbc3b27bb33f8 (patch) | |
tree | 1b135af4f422d2ebcb96e814c08923d52b2f85c3 /saylol.py | |
parent | e9b0ad656b71841fa23f332ddf8eff43e5cf1986 (diff) |
apply file read/save helpers
Diffstat (limited to 'saylol.py')
-rw-r--r-- | saylol.py | 20 |
1 files changed, 4 insertions, 16 deletions
@@ -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): |