From 7795e6bbf3b61dd3a06aca8926dc6c9117b01395 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 30 Aug 2003 19:52:56 +0000 Subject: [PATCH] Fixed help to work with plugin names. --- src/MiscCommands.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/MiscCommands.py b/src/MiscCommands.py index 134039d71..40d7cee4e 100755 --- a/src/MiscCommands.py +++ b/src/MiscCommands.py @@ -85,7 +85,7 @@ class MiscCommands(callbacks.Privmsg): if cb: method = getattr(cb, command) if hasattr(method, '__doc__') and method.__doc__ is not None: - doclines = method.__doc__.splitlines() + doclines = method.__doc__.strip().splitlines() help = doclines.pop(0) if doclines: s = '%s %s (for more help use the morehelp command)' @@ -95,16 +95,22 @@ class MiscCommands(callbacks.Privmsg): else: irc.reply(msg, 'That command exists, but has no help.') else: - for cb in irc.callbacks: - if cb.name() == command: - if hasattr(cb, '__doc__'): - doclines = cb.__doc__.splitlines() + cb = irc.getCallback(command) + if cb: + if hasattr(cb, '__doc__') and cb.__doc__ is not None: + 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)) irc.reply(msg, help) else: irc.error(msg, 'That callback has no help.') 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): """