summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/utils.py b/utils.py
index 93ad3ed..2acdb01 100644
--- a/utils.py
+++ b/utils.py
@@ -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)