Ejemplo n.º 1
0
def about_plugin(channel, user, plugin):
    ''' Gives usage information about the particular plugin
    (must be one of the loaded plugins)

    usage: `@me: about <plugin>`
    '''
    target_plugin = Plugin.find(plugin)
    if target_plugin:
        channel.post(clean_docstring(doc(target_plugin)))
    else:
        user.im("I am sorry, {!s} is not a loaded plugin.".format(plugin))
Ejemplo n.º 2
0
def about_hook(channel, user, plugin, hook):
    ''' Gives usage information about the particular command
    (must be one of the loaded plugins and a valid command)

    usage: `@me: about <plugin>.<command>`
    '''
    target_plugin = Plugin.find(plugin)
    if not target_plugin:
        user.im("I am sorry, {!s} is not a loaded plugin.".format(plugin))
        return

    target_hook = [_hook for _hook in target_plugin.hooks
                   if _hook.__name__ == hook]
    if not len(target_hook):
        user.im("I am sorry, {!s} is not a commaned for {!s}.".format(
            hook, plugin))
        return

    channel.post(clean_docstring(doc(target_hook[0])))