list loaded modules in DrBotIRC, display it via IrcAdmin
This commit is contained in:
parent
451084a1d9
commit
a6c7b6b0b2
|
@ -326,6 +326,15 @@ class DrBotIRC(irclib.IRC):
|
|||
|
||||
return 'Module ' + modname + ' reload failed. Check the console.'
|
||||
|
||||
def list_modules(self):
|
||||
"""List loaded modules."""
|
||||
|
||||
modnames = []
|
||||
for module in self.modlist:
|
||||
modnames.append(module.__class__.__name__)
|
||||
|
||||
return modnames
|
||||
|
||||
# SIGINT signal handler
|
||||
def sigint_handler(self, signal, frame):
|
||||
for module in self.modlist:
|
||||
|
|
|
@ -78,6 +78,8 @@ class IrcAdmin(Module):
|
|||
return self.sub_reload_module(connection, event, nick, userhost, what, admin_unlocked)
|
||||
elif whats[0] == '!unload' and admin_unlocked and len(whats) >= 2:
|
||||
return self.sub_unload_module(connection, event, nick, userhost, what, admin_unlocked)
|
||||
elif whats[0] == '!modules':
|
||||
return self.sub_list_modules(connection, event, nick, userhost, what, admin_unlocked)
|
||||
|
||||
def sub_join_channel(self, connection, event, nick, userhost, what, admin_unlocked):
|
||||
whats = what.split(' ')
|
||||
|
@ -158,5 +160,10 @@ class IrcAdmin(Module):
|
|||
whats = what.split(' ')
|
||||
return self.irc.reload_module(whats[1])
|
||||
|
||||
def sub_list_modules(self, connection, event, nick, userhost, what, admin_unlocked):
|
||||
"""Get the list of loaded modules from DrBotIRC and display it."""
|
||||
|
||||
return ', '.join(self.irc.list_modules())
|
||||
|
||||
# vi:tabstop=4:expandtab:autoindent
|
||||
# kate: indent-mode python;indent-width 4;replace-tabs on;
|
||||
|
|
Loading…
Reference in New Issue