From 23bddf358dc615d18ed4470f33f383f1eac9ac63 Mon Sep 17 00:00:00 2001 From: Mikhail Kirillov Date: Thu, 10 Oct 2024 06:20:52 +0400 Subject: Task #10. /announce command --- commands/users.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'commands/users.py') diff --git a/commands/users.py b/commands/users.py index 9dcc125..8808bf6 100644 --- a/commands/users.py +++ b/commands/users.py @@ -16,11 +16,11 @@ from collections import deque from strings import USER_NOT_PROVIDED, USERS_ADDED, USERS_REMOVED, \ EXPECTED_ONE_USER, USER_SET, USER_ADD, USER_REMOVE, ADD_MORE_USERS, \ NEXT_MOVIE_USER, USER_NOT_FOUND, USER_CHOOSE, NO_USERS, \ - EVENT_USER_HAD_EVENT -from utils import context_init, create_users_string, normalize_username, \ - choose_next_user + EVENT_USER_HAD_EVENT, NEXT_MOVIE +from utils import context_init, create_users_string, choose_next_user from predicates import has_finished_event + async def set_users( update: Update, context: ContextTypes.DEFAULT_TYPE @@ -86,7 +86,15 @@ async def who_is_next( if has_finished_event(context, users[0]): users = context.chat_data["users"] = choose_next_user(users) - await update.message.reply_text(NEXT_MOVIE_USER.format(user=users[0])) + next_user_string = NEXT_MOVIE_USER.format(user=users[0]) + + last_movie = context.chat_data["movies"][0] \ + if context.chat_data["movies"] != [] else None + + if last_movie and last_movie["user"] == users[0]: + next_user_string += NEXT_MOVIE.format(movie=last_movie["title"]) + + await update.message.reply_text(next_user_string) async def remove_users( -- cgit v1.2.3