Switch signals.py SIGHUP to also load new modules

This commit is contained in:
jesopo 2019-05-12 14:11:29 +01:00
parent 1c296826d7
commit 8c3ea677ec

View file

@ -48,17 +48,18 @@ class Module(ModuleManager.BaseModule):
def _reload_modules(self): def _reload_modules(self):
self.bot.log.info("Reloading modules", []) self.bot.log.info("Reloading modules", [])
reloaded = [] success = []
failed = [] fail = []
for name in list(self.bot.modules.modules.keys()): for name in list(self.bot.modules.modules.keys()):
try: try:
self._reload(name) self.bot.modules.unload_module(name)
except ModuleManager.ModuleWarning: except ModuleManager.ModuleWarning:
continue continue
except Exception as e: except Exception as e:
failed.append(name) failed.append(name)
continue continue
reloaded.append(name) load_success, load_fail = self.bot.load_modules(safe=True)
fail.extend(load_fail)
self.bot.log.info("Reloaded %d modules (%d failed)", self.bot.log.info("Reloaded %d modules (%d failed)",
[len(reloaded), len(failed)]) [len(load_success), len(fail)])