-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.py
More file actions
32 lines (23 loc) · 918 Bytes
/
common.py
File metadata and controls
32 lines (23 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import dotenv
from aiogram import Bot, types
dotenv.load_dotenv()
token = os.getenv("TOKEN")
bot = Bot(token)
game_code_to_host_dict = dict()
host_to_game_code = dict()
code_to_game = dict()
action = dict()
user_id_to_chat_id = dict()
user_id_to_name = dict()
used_codes = list()
images_dir = os.path.dirname("images")
last_image_num = int(os.getenv("LAST_IMAGE_NUM"))
ai_images_dir = os.path.dirname("ai_images")
last_ai_image_num = int(os.getenv("LAST_AI_IMAGE_NUM"))
mixed_images_dir = os.path.dirname("mixed_images")
async def update_caches(message: types.Message):
user_id_to_chat_id[message.from_user.id] = message.chat.id
first_name = message.from_user.first_name if message.from_user.first_name is not None else ""
last_name = message.from_user.last_name if message.from_user.last_name is not None else ""
user_id_to_name[message.from_user.id] = first_name + " " + last_name