Example #1
0
def about(channel):
    ''' Gives basic information about the bot
    including the creator/primary admin and loaded plugins.

    usage: `@me: about`
    '''
    about_msg = "Hi, I am {!s}, a bot in development by @{}".format(
        bot.user, config["creator"])
    channel.post(about_msg)
    channel.post("The plugins loaded for me are: {!s}".format(
        ", ".join(Plugin.loaded())))
Example #2
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))
Example #3
0
def unload(name, channel):
    ''' attempts to completely unload a plugin

    Note: this may not always work, it depends on if the internals are properly
    tracking everything.

    usage: `!unload <plugin>`
    '''
    plugin = Plugin.find(name)
    if not plugin:
        bot.post(channel, text="{!s} is not a loaded plugin".format(name))
        return

    plugin.unload()
Example #4
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])))