def handle_whereis(bot, ievent): """ arguments: <cmnd> - locate a command. """ try: cmnd = ievent.args[0] except IndexError: ievent.missing('<cmnd>') return cmnds.reloadcheck(bot, ievent, cmnd) plugin = cmnds.whereis(cmnd) if plugin: ievent.reply("%s command is in: %s" % (cmnd, plugin)) else: ievent.reply("can't find " + cmnd)
def handle_helpsite(bot, event): """ arguments: <cmnd> - help commands that gives a url to the docs. """ if event.rest: target = cmnds.whereis(event.rest) target = target or event.rest where = bot.plugs.getmodule(target) if where: theplace = os.sep.join(where.split(".")[-2:]) event.reply("help for %s is at http:///docs/tl/plugins/%s.html" % (event.rest.upper(), theplace)) else: event.reply("can't find a help url for %s" % event.rest) else: event.reply("documentation for tl can be found at http:// or http://tl.appspot.com/docs") event.reply('see !list for loaded plugins and "!help plugin" for a url to the plugin docs.') cmndhelp = cmnds.gethelp(event.rest) if cmndhelp: event.reply("docstring: ", cmndhelp.split("\n"))
def handle_help(bot, event): """ arguments: [<cmndname or plugname>] - show help. """ if not event.args: event.reply("documentation for tl can be found at http:///docs/tl") event.reply('see !list for loaded plugins and "!help plugin" for help on the plugin.') return t = event.args[0] logging.warn("help target is %s" % t) cmnds.reloadcheck(bot, event, t) where = cmnds.whereis(t) cmndhelp = cmnds.gethelp(t) if not cmndhelp: handle_helpplug(bot, event) ; return try: ex = examples[t].example except KeyError: ex = None p = cmnds.perms(t) res = "permissions: %s - location: %s - examples: %s" % (", ".join(p), where, ex) event.reply('help on %s command: %s' % (event.rest, cmndhelp), res.split(" - "), dot="<br>")