def view_queue(queue: Queue, message: Message) -> None: """ Function to see who is in line """ if not queue.queue_length(): bot.send_message(message.chat.id, "В очереди никого нет") else: if queue.queue_length() > 4: bot.send_message(message.chat.id, show_many_users(queue)) else: bot.send_message(message.chat.id, show_few_users(queue)) bot.register_next_step_handler(message, main)
def clear_queue(queue: Queue, message: Message) -> None: """ Remove all people from the queue """ if queue.queue_length(): queue.clear_queue() bot.send_message(message.chat.id, "Очередь очищена!", reply_markup=keyboard_admin) else: bot.send_message(message.chat.id, "В очереди никого нет") bot.register_next_step_handler(message, main)
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)