make the new config system actually fully reloadable

also removed a few leftover lines from commands.py
This commit is contained in:
jan6 2022-10-05 05:41:01 -07:00
parent 7586114e73
commit 345f689e3d
2 changed files with 6 additions and 5 deletions

View File

@ -40,11 +40,9 @@ class Command:
def _(self, *args, **kwargs):
if func.__name__ == "help":
self.admin_commands = adm_cmds
# func.admin_commands=adm_cmds
if not self.admin:
self.err_perm()
else:
# return func(self)
return func(
self,
self.prefix,
@ -72,7 +70,6 @@ class Command:
def _(self, *args, **kwargs):
if func.__name__ == "help":
self.commands = cmds
# func.commands=cmds
if func.__name__ not in self.config.cmd.disabled:
return func(
self,

View File

@ -1,6 +1,8 @@
import importlib, sys
# default config file, copy the contents into local_config.py and modify
if __name__ == "local_config":
from config import config
config = importlib.reload(sys.modules["config"]).config
else:
class config: # dummy, so the local config can simply be a copy of this template
@ -58,6 +60,8 @@ class config(config):
# you can remove the following lines if you're editing local_config.py
if __name__ == "config":
try:
from local_config import config
config = importlib.reload(sys.modules["local_config"]).config
except ModuleNotFoundError:
print("\x1b[31m!!! you should probably set up local config !!!\x1b[0m")
except KeyError:
from local_config import config