Changeset 6623428 in python-cinema-club-bot for commands/users.py
- Timestamp:
- Oct 9, 2024, 10:46:19 PM (5 weeks ago)
- Branches:
- master
- Children:
- 9be02d9
- Parents:
- 0d48ea2
- git-author:
- Mikhail Kirillov <w96k@…> (10/09/24 04:53:26)
- git-committer:
- Mikhail Kirillov <w96k@…> (10/09/24 22:46:19)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
commands/users.py
r0d48ea2 r6623428 15 15 16 16 from strings import USER_NOT_PROVIDED, USERS_ADDED, USERS_REMOVED, \ 17 EXPECTED_ONE_USER, USER_SET, USER_ADD, USER_REMOVE 18 from utils import context_init 17 EXPECTED_ONE_USER, USER_SET, USER_ADD, USER_REMOVE, ADD_MORE_USERS, \ 18 NEXT_MOVIE_USER, USER_NOT_FOUND, USER_CHOOSE 19 from utils import context_init, create_users_string 19 20 20 21 … … 54 55 context_init(context) 55 56 56 await update.message.reply_text(context.chat_data["users"]) 57 users = context.chat_data["users"] 58 59 await update.message.reply_markdown(create_users_string(users)) 60 61 62 async def who_is_next( 63 update: Update, 64 context: ContextTypes.DEFAULT_TYPE 65 ) -> None: 66 context_init(context) 67 68 users = context.chat_data["users"] 69 70 if len(users) > 0: 71 await update.message.reply_text(NEXT_MOVIE_USER.format(user=users[0])) 72 else: 73 await update.message.reply_text(ADD_MORE_USERS) 57 74 58 75 … … 92 109 users = deque(context.chat_data["users"]) 93 110 94 chooser_index = users.index(chooser) 111 try: 112 chooser_index = users.index(chooser) 113 except ValueError: 114 raise error.TelegramError(USER_NOT_FOUND.format(user=chooser)) 115 95 116 users.rotate(-chooser_index) 117 users = list(users) 96 118 97 context.chat_data["users"] = list(users)119 context.chat_data["users"] = users 98 120 99 await update.message.reply_text(context.chat_data["users"]) 121 await update.message.reply_text(USER_CHOOSE.format(user=users[0])) 122 123 await update.message.reply_markdown(create_users_string(users))
Note:
See TracChangeset
for help on using the changeset viewer.