Changeset 69dd60c in python-cinema-club-bot for commands/users.py
- Timestamp:
- Oct 11, 2024, 1:53:24 AM (5 weeks ago)
- Branches:
- master
- Children:
- ac7b16a
- Parents:
- 694d823
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
commands/users.py
r694d823 r69dd60c 17 17 EXPECTED_ONE_USER, USER_SET, USER_REMOVE, ADD_MORE_USERS, \ 18 18 NEXT_MOVIE_USER, USER_NOT_FOUND, USER_CHOOSE, NO_USERS, \ 19 EVENT_USER_HAD_EVENT, NEXT_MOVIE 20 from utils import context_init, create_users_string, choose_next_user 21 from predicates import has_finished_event 19 NEXT_MOVIE 20 from utils import context_init, create_users_string, choose_next_user, \ 21 normalize_username 22 from predicates import has_finished_movie, has_event_without_movie 22 23 23 24 … … 61 62 if users == []: 62 63 await update.message.reply_text(NO_USERS) 63 else: 64 if has_finished_event(context, users[0]): 65 users = context.chat_data["users"] = choose_next_user(users) 64 return 66 65 67 await update.message.reply_markdown(create_users_string(users)) 66 if has_finished_movie(context): 67 users = context.chat_data["users"] = choose_next_user(context) 68 69 await update.message.reply_markdown(create_users_string(users)) 68 70 69 71 … … 83 85 raise error.TelegramError(ADD_MORE_USERS) 84 86 85 if has_finished_ event(context, users[0]):86 users = context.chat_data["users"] = choose_next_user( users)87 if has_finished_movie(context): 88 users = context.chat_data["users"] = choose_next_user(context) 87 89 88 90 next_user_string = NEXT_MOVIE_USER.format(user=users[0]) 89 91 90 last_movie = context.chat_data["movies"][ 0] \92 last_movie = context.chat_data["movies"][-1] \ 91 93 if context.chat_data["movies"] != [] else None 92 94 93 if last_movie and last_movie["user"] == users[0]:95 if last_movie and last_movie["user"] == normalize_username(users[0]): 94 96 next_user_string += NEXT_MOVIE.format(movie=last_movie["title"]) 95 97 … … 142 144 context.chat_data["users"] = users 143 145 144 if has_finished_ event(context, users[0]):145 await update.message.reply_text(146 EVENT_USER_HAD_EVENT.format(user=users[0]) 147 )148 users = context.chat_data["users"] = choose_next_user(users)146 if has_finished_movie(context): 147 users = context.chat_data["users"] = choose_next_user(context) 148 149 if has_event_without_movie(context): 150 context.chat_data["events"][-1]["user"] = users[0] 149 151 150 152 await update.message.reply_text(USER_CHOOSE.format(user=users[0]))
Note:
See TracChangeset
for help on using the changeset viewer.