apply file read/save helpers

This commit is contained in:
jomo
2014-07-27 19:42:33 +02:00
parent 2e7e021001
commit aad63e5416
10 changed files with 42 additions and 121 deletions

View File

@@ -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):