Actually implement !reloadallmodules in modules.py
This commit is contained in:
parent
b7f7c9342b
commit
967ed65e00
1 changed files with 13 additions and 8 deletions
|
@ -57,18 +57,23 @@ class Module(object):
|
||||||
def reload_all(self, event):
|
def reload_all(self, event):
|
||||||
reloaded = []
|
reloaded = []
|
||||||
failed = []
|
failed = []
|
||||||
for name in self.bot.modules.modules.keys():
|
for name in list(self.bot.modules.modules.keys()):
|
||||||
try:
|
try:
|
||||||
self._reload(name)
|
self._reload(name)
|
||||||
except ModuleManager.ModuleNotFoundException:
|
except ModuleWarning:
|
||||||
failed.append
|
continue
|
||||||
if not self._reload(event):
|
except:
|
||||||
failed.append(name)
|
failed.append(name)
|
||||||
else:
|
continue
|
||||||
reloaded.append(name)
|
reloaded.append(name)
|
||||||
|
|
||||||
event["stdout"].write("Reloaded modules: %s" % \
|
if reloaded and failed:
|
||||||
" ".join(modules_reloaded))
|
event["stdout"].write("Reloaded %d modules, %d failed" % (
|
||||||
|
len(reloaded), len(failed)))
|
||||||
|
elif failed:
|
||||||
|
event["stdout"].write("Failed to reload all modules")
|
||||||
|
else:
|
||||||
|
event["stdout"].write("Reloaded %d modules" % len(reloaded))
|
||||||
|
|
||||||
def enable(self, event):
|
def enable(self, event):
|
||||||
name = event["args_split"][0].lower()
|
name = event["args_split"][0].lower()
|
||||||
|
|
Loading…
Reference in a new issue