lots of nonworking code
This commit is contained in:
parent
ed2eefb9cd
commit
d330df5711
9 changed files with 75 additions and 34 deletions
|
@ -8,10 +8,11 @@ from watchdog.tricks import Trick
|
|||
|
||||
|
||||
class Config(dict):
|
||||
def __init__(self, logger, *args, **kwargs):
|
||||
def __init__(self, bot, *args, **kwargs):
|
||||
self.filename = "config.json"
|
||||
self.path = os.path.abspath(self.filename)
|
||||
self.logger = logger
|
||||
self.bot = bot
|
||||
self.logger = bot.logger
|
||||
self.update(*args, **kwargs)
|
||||
|
||||
# populate self with config data
|
||||
|
@ -35,6 +36,12 @@ class Config(dict):
|
|||
self.update(json.load(f))
|
||||
self.logger.info("Config loaded from file.")
|
||||
|
||||
# reload permissions
|
||||
if self.bot.connections:
|
||||
for conn in self.bot.connections:
|
||||
conn.permissions.reload()
|
||||
|
||||
|
||||
def save_config(self):
|
||||
"""saves the contents of the config dict to the config file"""
|
||||
json.dump(self, open(self.path, 'w'), sort_keys=True, indent=2)
|
||||
|
|
Reference in a new issue