Beispiel #1
0
def handle_help(bot, event):
    """ arguments: [<cmndname or plugname>] - show help. """
    if not event.args:
        event.reply(
            "documentation for jsonbot can be found at http://jsonbot.org")
        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:
        ex = examples.get(t)
        if ex: cmndhelp = ex.descr
    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('<br><b>%s command:</b> %s' % (event.rest, cmndhelp),
                res.split(" - "),
                dot="<br>")
Beispiel #2
0
def handle_whereis(bot, ievent):
    """ arguments: <cmnd> - locate a command. """
    try: cmnd = ievent.args[0]
    except IndexError:
        ievent.missing('<cmnd>')
        return
    plugin = cmnds.whereis(cmnd)
    if plugin: ievent.reply("%s command is in: %s" %  (cmnd, plugin))
    else: ievent.reply("can't find " + cmnd)
Beispiel #3
0
def handle_whereis(bot, ievent):
    """ locate a command. """
    try:
        cmnd = ievent.args[0]
    except IndexError:
        ievent.missing('<cmnd>')
        return
    plugin = cmnds.whereis(cmnd)
    if plugin: ievent.reply("%s command is in: %s" % (cmnd, plugin))
    else: ievent.reply("can't find " + cmnd)
Beispiel #4
0
def handle_help(bot, event):
     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://jsonbot.appspot.com/docs/html/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 jsonbot can be found at http://jsonbot.appspot.com/docs")
         event.reply("see !list for loaded plugins and !help <plugin> for a url to the plugin docs.")
Beispiel #5
0
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://jsonbot.org/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 jsonbot can be found at http://jsonbot.org or http://jsonbot.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("<br><b>%s docstring: </b><br>" % event.rest, cmndhelp.split("\n"))
Beispiel #6
0
def handle_help(bot, event):
    """ arguments: [<cmndname or plugname>] - show help. """
    if not event.rest:
        event.reply("documentation for jsonbot can be found at http://jsonbot.org")
        event.reply('see !list for loaded plugins and "!help plugin" for help on the plugin.')
        return
    target = cmnds.whereis(event.rest)
    target = target or event.rest
    where = bot.plugs.getmodule(target)
    cmndhelp = cmnds.gethelp(event.rest)
    if cmndhelp: event.reply('help on %s: ' % event.rest, cmndhelp.split("\n"))
    elif where: handle_helpplug(bot, event) ; return
    else: event.reply("can't find help on %s" % event.rest) ; return
    try: event.reply("examples: %s" % examples[event.rest].example)
    except KeyError: event.reply("no examples found")
    event.reply("permissions: %s" % ", ".join(cmnds.perms(event.rest)))
    if where: event.reply("%s is in the %s plugin" % (event.rest, where))
Beispiel #7
0
def handle_help(bot, event):
    """ arguments: [<cmndname or plugname>] - show help. """
    if not event.args:
        event.reply("documentation for jsonbot can be found at http://jsonbot.org")
        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)
    #where = bot.plugs.getmodule(t)
    cmndhelp = cmnds.gethelp(t)
    if cmndhelp: event.reply('help on %s: ' % event.rest, cmndhelp.split("\n"))
    elif bot.plugs.get(t): handle_helpplug(bot, event) ; return
    else: event.reply("can't find help on %s" % event.rest) ; return
    try: ex = examples[t].example
    except KeyError: ex = None
    p = cmnds.perms(t)
    event.reply("permissions: %s - location: %s - examples: %s" % (", ".join(p), where, ex))
Beispiel #8
0
def handle_help(bot, event):
    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://jsonbot.appspot.com/docs/html/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 jsonbot can be found at http://jsonbot.appspot.com/docs"
        )
        event.reply(
            "see !list for loaded plugins and !help <plugin> for a url to the plugin docs."
        )
Beispiel #9
0
def handle_help(bot, event):
    """ arguments: [<cmndname or plugname>] - show help. """
    if not event.args:
        event.reply("documentation for jsonbot can be found at http://jsonbot.org")
        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:
        ex = examples.get(t)
        if ex: cmndhelp = ex.descr
    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('<br><b>%s command:</b> %s' % (event.rest, cmndhelp), res.split(" - "), dot="<br>")
Beispiel #10
0
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://jsonbot.org/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 jsonbot can be found at http://jsonbot.org or http://jsonbot.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("<br><b>%s docstring: </b><br>" % event.rest,
                    cmndhelp.split("\n"))