-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.py
executable file
·67 lines (56 loc) · 1.95 KB
/
variables.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import os
from dataclasses import dataclass
import telegram
@dataclass
class LastMessages:
last_user_message: telegram.Message
last_group_message: telegram.Message
first_user_message: telegram.Message
first_group_message: telegram.Message
@dataclass
class Checks:
# for user's fullname checking at the start
fullname_check: bool
# for checking if the payment request has been proposed to the executive group
signin_up_note_check: bool
# user infos class
@dataclass
class UserInfos:
link: str
name: str
id: int
username: str
last_mess: LastMessages
checks: Checks
first_name: str = ""
last_name: str = ""
full_name: str = ""
full_name_temp: str = ""
# Bot token
TOKEN = os.environ.get('BOT_TOKEN')
# Executive chat ID
CHAT_ID = os.environ.get('EXECUTIVE_CHAT_ID')
# users dictionary - per l'uso contemporaneo
users_dict = {}
def _set(starting_infos: telegram.User, starting_message: telegram.Message):
users_dict[starting_infos.username] = UserInfos(
username=starting_infos.username,
id=starting_infos.id,
link="https://t.me/" + starting_infos.username,
name=starting_infos.name,
last_mess=LastMessages(
last_user_message=starting_message,
last_group_message=starting_message,
first_user_message=starting_message,
first_group_message=starting_message
),
checks=Checks(
fullname_check=False,
signin_up_note_check=False,
)
)
if starting_infos.last_name is not None:
users_dict[starting_infos.username].first_name = starting_infos.first_name
users_dict[starting_infos.username].last_name = starting_infos.last_name
users_dict[starting_infos.username].full_name = \
users_dict[starting_infos.username].first_name + " " + users_dict[starting_infos.username].last_name