def handle_admincommands(bot, ievent): """ load all available plugins. """ cmnds = getcmndtable() if not ievent.rest: ievent.reply("commands: ", cmnds) else: try: ievent.reply("%s command is found in %s " % (ievent.rest, cmnds[ievent.rest])) except KeyError: ievent.reply("no such commands available")
def handle_apro(bot, ievent): """ arguments: <searchtxt> - apropos (search) for commands. """ try: what = ievent.args[0] except IndexError: ievent.missing('<what>') return result = [] cmnds = getcmndtable() for i in cmnds.keys(): if what in i: result.append(i) result.sort() if result: ievent.reply("commands matching %s: " % what, result) else: ievent.reply('no matching commands found for %s' % what)
def handle_commands(bot, ievent): """ arguments: [<plugname>] - show commands of plugin. """ try: plugin = ievent.args[0].lower() except IndexError: plugin = "" result = [] cmnds = getcmndtable() for cmnd, plugname in cmnds.iteritems(): if plugname: if not plugin or plugin in plugname: result.append(cmnd) if result: result.sort() if not plugin: plugin = "JSONBOT" ievent.reply('%s has the following commands: ' % plugin, result) else: ievent.reply('no commands found for plugin %s' % plugin)
def handle_apro(bot, ievent): """ apropos for command. """ try: what = ievent.args[0] except IndexError: ievent.missing('<what>') return result = [] cmnds = getcmndtable() for i in cmnds.keys(): if what in i: result.append(i) result.sort() if result: ievent.reply("commands matching %s: " % what, result) else: ievent.reply('no matching commands found for %s' % what)