Esempio n. 1
0
def _clear(id, connection):
    size = data.execute_read_query(connection,
                                   ids_handler.count_handles(id))[0][0]
    data.execute_query(connection, ids_handler.remove_id(id))

    if size > maximumExtraHandles:
        data.execute_query(connection, data.delete_extra_handles())

    data.execute_query(connection, keys_handler.remove_keys(id))
    data.execute_query(connection, queue_handler.remove_id(id))
    return 'Все данные успешно удалены'
Esempio n. 2
0
def remove_handles(message):
    id = message.chat.id
    connection = data.create_connection(dbname)

    args = message.text.split()[1:]
    if len(args) == 0:
        data.execute_query(connection, queue_handler.remove_id(id))
        data.execute_query(connection, queue_handler.insert_id(id, 1))
        send_message(id, 'Введите хэндлы', markup=util.create_keyboard())
    else:
        send_message(id, util._remove_handles(id, args, connection))

    connection.close()
Esempio n. 3
0
def text_handler(message):
    id = message.chat.id
    connection = data.create_connection(dbname)

    resp = data.execute_read_query(connection, queue_handler.select_type(id))
    if resp == []:
        connection.close()
        return

    data.execute_query(connection, queue_handler.remove_id(id))
    args = message.text.split()
    if resp[0][0] == 0:
        message = util._add_handles(id, args, connection)
    elif resp[0][0] == 1:
        message = util._remove_handles(id, args, connection)
    else:
        if len(args) == 2:
            message = util._add_keys(id, args, connection)
        else:
            message = 'Неверные аргументы. Посмотрите /help'
    send_message(id, message)

    connection.close()
Esempio n. 4
0
def _cancel(id, connection):
    data.execute_query(connection, queue_handler.remove_id(id))
    return 'Отменено'