diff options
author | Mikhail Kirillov <w96k@runbox.com> | 2024-10-10 04:12:00 +0400 |
---|---|---|
committer | Mikhail Kirillov <w96k@runbox.com> | 2024-10-10 04:12:00 +0400 |
commit | 9be02d9141c14a3e3ca28567dbaff671de83200f (patch) | |
tree | ecc8c2f7023654179d51e2fdee68b1d688c131d8 /utils.py | |
parent | 662342863e37e8661f818218df7bb72bc18bf4eb (diff) |
Fix #9. Add events commands
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -10,7 +10,7 @@ # <http://creativecommons.org/publicdomain/zero/1.0/> from telegram.ext import ContextTypes - +from collections import deque def context_init(context: ContextTypes.DEFAULT_TYPE): """ @@ -23,6 +23,9 @@ def context_init(context: ContextTypes.DEFAULT_TYPE): if "movies" not in context.chat_data: context.chat_data["movies"]: list[dict] = [] + if "events" not in context.chat_data: + context.chat_data["events"]: list[dict] = [] + return context @@ -32,3 +35,10 @@ def normalize_username(username: str): def create_users_string(users: list[str]) -> str: return "`" + ", ".join(users) + "`" + + +def choose_next_user(users: list[dict]) -> list[dict]: + users = deque(users) + users.rotate(-1) # -1 moves list to left by 1 element + + return list(users) |