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>")
def handle_perm(bot, ievent): """ arguments: <cmnd> - get permission of command. """ try:cmnd = ievent.args[0] except IndexError: ievent.missing("<cmnd>") return try: perms = cmnds.perms(cmnd) except KeyError: ievent.reply("no %sw command registered") return if perms: ievent.reply("%s command needs %s permission" % (cmnd, perms)) else: ievent.reply("can't find perm for %s" % cmnd)
def handle_perm(bot, ievent): """ arguments: <cmnd> - get permission of command. """ try: cmnd = ievent.args[0] except IndexError: ievent.missing("<cmnd>") return try: perms = cmnds.perms(cmnd) except KeyError: ievent.reply("no %sw command registered") return if perms: ievent.reply("%s command needs %s permission" % (cmnd, perms)) else: ievent.reply("can't find perm for %s" % cmnd)
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))
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))
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>")