tidy cloudbot3/refresh code!

This commit is contained in:
Luke Rogers 2014-03-06 14:15:04 +13:00
parent f81cf21b57
commit 99e363cc99
12 changed files with 66 additions and 53 deletions

View file

@ -21,6 +21,7 @@ class Config(dict):
# start watcher
self.watcher()
def load_config(self):
"""(re)loads the bot config from the config file"""
if not os.path.exists(self.path):
@ -41,13 +42,11 @@ class Config(dict):
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)
self.logger.info("Config saved to file.")
def watcher(self):
"""starts the watchdog to automatically reload the config when it changes on disk"""
self.observer = Observer()