Пример #1
0
def process_commands():
    vk_bot = bot.get_bot()

    messages = vk_bot.wait_for_messages()

    for msg in messages:
        if utils.is_command(msg['body']):
            try:
                LOG.info("Executing command '%s'..." % msg['body'])
                commands.execute_cmd(msg, msg['body'])
            except Exception as e:
                e_msg = "'%s' cmd failed: %s" % (msg['body'], e.message)
                LOG.warn(e_msg)
                vk_bot.answer_on_message(msg, e_msg)

    if messages:
        vk_bot.mark_messages_as_read(messages)