def handle_admincommands(bot, ievent): """ no arguments - 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_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.items(): if plugname: if not plugin or plugin in plugname: result.append(cmnd) if result: result.sort() if not plugin: plugin = "T I M E L I N E" ievent.reply('%s has the following commands: ' % plugin, result) else: ievent.reply('no commands found for plugin %s' % plugin)