Compare commits

..

2 Commits

Author SHA1 Message Date
none
b076bfc71a Merge remote-tracking branch 'refs/remotes/origin/main' 2024-03-09 15:29:55 +03:00
none
11962b7a70 up 2024-03-09 15:29:21 +03:00

6
db.py
View File

@ -7,9 +7,15 @@ if not os.path.exists('config.json'):
with open("config.json", "w") as outfile: with open("config.json", "w") as outfile:
outfile.write(js) outfile.write(js)
print('Created new config.json') print('Created new config.json')
exit()
def read(file = 'config.json'): def read(file = 'config.json'):
if not os.path.exists(file):
with open(file, "w") as f:
f.write("{}")
f.close()
with open(file, "r", encoding="utf-8") as openfile: with open(file, "r", encoding="utf-8") as openfile:
db = json.load(openfile) db = json.load(openfile)
return db return db