Debug mode added
This commit is contained in:
parent
de0df8f0f6
commit
c5e6db79a0
1
.gitignore
vendored
1
.gitignore
vendored
@ -154,6 +154,7 @@ cython_debug/
|
||||
|
||||
# Custom
|
||||
config.json
|
||||
config_debug.json
|
||||
*.session
|
||||
*.session-journal
|
||||
users
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"locale": "uk",
|
||||
"debug": false,
|
||||
"owner": 0,
|
||||
"age_allowed": 0,
|
||||
"birthdays_notify": true,
|
||||
|
@ -47,6 +47,12 @@ def configSet(key: str, value, *args: str, file: str = "config"):
|
||||
else:
|
||||
filepath = f"data{sep}users{sep}"
|
||||
this_dict = jsonLoad(f"{filepath}{file}.json")
|
||||
if this_dict["debug"]:
|
||||
try:
|
||||
this_dict = jsonLoad("config_debug.json")
|
||||
file = "config_debug"
|
||||
except FileNotFoundError:
|
||||
print("Debug mode is set but config_debug.json is not there! Falling back to config.json", flush=True)
|
||||
string = "this_dict"
|
||||
for arg in args:
|
||||
string += f'["{arg}"]'
|
||||
@ -71,8 +77,13 @@ def configGet(key: str, *args: str, file: str = "config"):
|
||||
try:
|
||||
this_dict = jsonLoad("config.json")
|
||||
except FileNotFoundError:
|
||||
print("Config file not found! Copy config_example.json to config.json, configure it and rerun the bot!")
|
||||
print("Config file not found! Copy config_example.json to config.json, configure it and rerun the bot!", flush=True)
|
||||
exit()
|
||||
if this_dict["debug"]:
|
||||
try:
|
||||
this_dict = jsonLoad("config_debug.json")
|
||||
except FileNotFoundError:
|
||||
print("Debug mode is set but config_debug.json is not there! Falling back to config.json", flush=True)
|
||||
else:
|
||||
this_dict = jsonLoad(f"data{sep}users{sep}{file}.json")
|
||||
this_key = this_dict
|
||||
|
Reference in New Issue
Block a user