Added getPluginHelp() method to return docstring for individual plugins.

This commit is contained in:
Ali Afshar 2005-03-03 19:34:26 +00:00
parent b7736d83e1
commit d13458726d
2 changed files with 8 additions and 2 deletions

View File

@ -47,8 +47,9 @@ class Plugin(callbacks.Plugin):
Returns a useful description of how to use <plugin>, if the plugin has Returns a useful description of how to use <plugin>, if the plugin has
one. one.
""" """
if hasattr(cb, '__doc__') and cb.__doc__: doc = cb.getPluginHelp()
irc.reply(utils.str.normalizeWhitespace(cb.__doc__)) if doc:
irc.reply(utils.str.normalizeWhitespace(doc))
else: else:
irc.reply('That plugin is loaded, but has no plugin help.') irc.reply('That plugin is loaded, but has no plugin help.')
help = wrap(help, ['plugin']) help = wrap(help, ['plugin'])

View File

@ -1191,6 +1191,11 @@ class PluginMixin(BasePlugin, irclib.IrcCallback):
else: else:
group.set(value) group.set(value)
def getPluginHelp(self):
if hasattr(self, '__doc__'):
return self.__doc__
else:
return None
class Plugin(PluginMixin, Commands): class Plugin(PluginMixin, Commands):
pass pass