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))
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()
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])))