Fixed help to work with plugin names.

This commit is contained in:
Jeremy Fincher 2003-08-30 19:52:56 +00:00
parent 26f28e52d7
commit 7795e6bbf3

View File

@ -85,7 +85,7 @@ class MiscCommands(callbacks.Privmsg):
if cb: if cb:
method = getattr(cb, command) method = getattr(cb, command)
if hasattr(method, '__doc__') and method.__doc__ is not None: if hasattr(method, '__doc__') and method.__doc__ is not None:
doclines = method.__doc__.splitlines() doclines = method.__doc__.strip().splitlines()
help = doclines.pop(0) help = doclines.pop(0)
if doclines: if doclines:
s = '%s %s (for more help use the morehelp command)' s = '%s %s (for more help use the morehelp command)'
@ -95,16 +95,22 @@ class MiscCommands(callbacks.Privmsg):
else: else:
irc.reply(msg, 'That command exists, but has no help.') irc.reply(msg, 'That command exists, but has no help.')
else: else:
for cb in irc.callbacks: cb = irc.getCallback(command)
if cb.name() == command: if cb:
if hasattr(cb, '__doc__'): if hasattr(cb, '__doc__') and cb.__doc__ is not None:
doclines = cb.__doc__.splitlines() doclines = cb.__doc__.strip().splitlines()
help = ' '.join(map(str.strip, doclines))
irc.reply(msg, help)
else:
module = __import__(cb.__module__)
if hasattr(module, '__doc__') and module.__doc__:
doclines = module.__doc__.strip().splitlines()
help = ' '.join(map(str.strip, doclines)) help = ' '.join(map(str.strip, doclines))
irc.reply(msg, help) irc.reply(msg, help)
else: else:
irc.error(msg, 'That callback has no help.') irc.error(msg, 'That callback has no help.')
else: else:
irc.error(msg, 'There is no such command.') irc.error(msg, 'There is no such command or callback.')
def morehelp(self, irc, msg, args): def morehelp(self, irc, msg, args):
"""<command> """<command>