Пример #1
0
def do(name, *args):
    global is_busy
    if handle:
        if name not in actions:
            console.error("Обработчик для события \"{}\" не найден. Добавьте\
     обработчик, либо отключите эту настройку в группе".format(name))
        else:
            is_busy = True
            actions[name](*args)
            is_busy = False
Пример #2
0
def listen(this_vk, this_config):
    global VK, config, commands
    VK = this_vk
    config = this_config
    init()
    while True:
        text = input()
        if text in commands.keys():
            commands[text]()
        else:
            console.error("Команда \"{}\" не найдена.".format(text))
Пример #3
0
def query_one(line):
    global connections
    conn = connections[threading.current_thread().name]
    try:
        conn.cursor.execute(line)
        result = conn.cursor.fetchone()
        conn.db.commit()
    except Exception as ex:
        init()
        console.error("MySQL ошибка: {}".format(str(ex)))
        result = query_one(line)
    return result
Пример #4
0
 def get_bind(self, key):
     if key not in self.config['binds']:
         console.error("Ключ \"{}\" не найден в конфигурационном файле".format(key))
         return None
     else:
         return self.config['binds'][key]