diff options
author | Mikhail Kirillov <w96k@runbox.com> | 2024-10-10 06:20:52 +0400 |
---|---|---|
committer | Mikhail Kirillov <w96k@runbox.com> | 2024-10-10 06:20:52 +0400 |
commit | 23bddf358dc615d18ed4470f33f383f1eac9ac63 (patch) | |
tree | 9d9ac4e9aa31c237b9a7776abc27dcd597d6d4e6 /commands/users.py | |
parent | 8d2d5acde9d4d7d44d93c386e541692f4e45a271 (diff) |
Task #10. /announce command
Diffstat (limited to 'commands/users.py')
-rw-r--r-- | commands/users.py | 16 |
1 files changed, 12 insertions, 4 deletions
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( |