Exemplo n.º 1
0
def show_few_users(queue: Queue) -> str:
    """
    Return string with all users
    """
    users_list = ''
    for user_id, first_name, last_name, _ in queue.show_all_user():
        users_list += f"[{user_id}] {first_name} {last_name}\n"
    return users_list
Exemplo n.º 2
0
def get_in_line(queue: Queue, message: Message) -> None:
    """
    Get to the end of the queue
    """
    if message.from_user.id not in \
            [telegram_id[3] for telegram_id in queue.show_all_user()]:
        bot.send_message(message.chat.id, 'Ваше имя и фамилия')
        bot.register_next_step_handler(message, get_full_name)
    else:
        bot.send_message(message.chat.id,
                         "Ты уже в очереди!",
                         reply_markup=keyboard_main)
        bot.register_next_step_handler(message, main_menu)
Exemplo n.º 3
0
def delete_first(queue: Queue, message: Message) -> None:
    """
    Delete a first person in the queue
    """
    if queue.queue_length():
        deleted_user = queue.delete_first_user()
        first_name, last_name = deleted_user[1], deleted_user[2]
        bot.send_message(message.chat.id,
                         f"\"{first_name} {last_name}\" был удален",
                         reply_markup=keyboard_admin)
        if queue.queue_length() > 0:
            bot.send_message(queue.show_first_user()[3],
                             'Сейчас твоя очередь!')
        if queue.queue_length() > 1:
            bot.send_message(queue.show_all_user()[1][3],
                             "Приготовься, ты следуюющий)")
    else:
        bot.send_message(message.chat.id,
                         "Некого удалять",
                         reply_markup=keyboard_admin)
    bot.register_next_step_handler(message, main)