Пример #1
0
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") 
Пример #2
0
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")
Пример #3
0
Файл: core.py Проект: code2u/jsb
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)
Пример #4
0
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)
Пример #5
0
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)
Пример #6
0
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)