1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 22:27:28 +00:00

Moved config file creation and loading into utils

This commit is contained in:
Myned 2017-10-13 23:38:27 -04:00
parent 2ff61c4794
commit efd035fce5

View file

@ -30,8 +30,16 @@ def dump(obj, filename):
tasks = setdefault('./cogs/tasks.pkl', {}) tasks = setdefault('./cogs/tasks.pkl', {})
with open('config.json') as infile: try:
config = json.load(infile) with open('config.json') as infile:
config = json.load(infile)
print('\"config.json\" loaded.')
except FileNotFoundError:
with open('config.json', 'w') as outfile:
json.dump({'client_id': 0, 'listed_ids': [0], 'owner_id': 0, 'permissions': 126016, 'prefix': ',',
'shutdown_channel': 0, 'startup_channel': 0, 'token': 'str'}, outfile, indent=4, sort_keys=True)
raise FileNotFoundError(
'Config file not found: \"config.json\" created with abstract values. Restart \"run.py\" with correct values.')
async def clear(obj, interval=10 * 60, replace=None): async def clear(obj, interval=10 * 60, replace=None):