source: python-cinema-club-bot/utils.py@ 6623428

Last change on this file since 6623428 was 6623428, checked in by Mikhail Kirillov <w96k@…>, on Oct 9, 2024 at 10:46:19 PM

Add movies commands

  • Property mode set to 100644
File size: 1.0 KB
Line 
1# This file is part of python-cinema-club-bot
2# contributed in 2024 by Mikhail Kirillov (~w96k) <w96k@runbox.com>
3
4# To the extent possible under law, the author(s) have dedicated all copyright
5# and related and neighboring rights to this software to the public domain
6# worldwide. This software is distributed without any warranty.
7
8# You should have received a copy of the CC0 Public Domain Dedication along
9# with this software. If not, see:
10# <http://creativecommons.org/publicdomain/zero/1.0/>
11
12from telegram.ext import ContextTypes
13
14
15def context_init(context: ContextTypes.DEFAULT_TYPE):
16 """
17 Initialize chat context with starting values
18 """
19
20 if "users" not in context.chat_data:
21 context.chat_data["users"]: list[str] = []
22
23 if "movies" not in context.chat_data:
24 context.chat_data["movies"]: list[dict] = []
25
26 return context
27
28
29def normalize_username(username: str):
30 return username.replace("@", "")
31
32
33def create_users_string(users: list[str]) -> str:
34 return "`" + ", ".join(users) + "`"
Note: See TracBrowser for help on using the repository browser.