-
Notifications
You must be signed in to change notification settings - Fork 0
/
Message.py
55 lines (44 loc) · 1.53 KB
/
Message.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
from config import temp_texts
class Message:
def __init__(self, event=None, name='', surname='', nick='', text='', time=None, status=0, items=None):
self.event = event
if event is not None:
self.chat_id = event.chat_id
self.user_id = event.user_id
self.items = items
self.name = name
self.surname = surname
self.nick = nick
self.time = time
self.status = status
if text is not None:
self.text_low = text.lower()
self.text = text
if self.status is None:
self.status = 0
self.status_text = 'User'
if self.status != 0:
self.status_text = temp_texts['STATUS' + str(self.status)]
else:
self.status_text = 'User'
def update(self, event, name, surname, nick, text, time, status, items):
self.event = event
self.chat_id = event.chat_id
self.user_id = event.user_id
self.items = items
self.name = name
self.surname = surname
self.nick = nick
self.time = time
self.status = status
self.text_low = text.lower()
self.text = text
if self.status is None:
self.status = 0
self.status_text = 'User'
if self.status != 0:
self.status_text = temp_texts['STATUS' + str(self.status)]
else:
self.status_text = 'User'
def __repr__(self):
return f"{self.time} [{self.status_text}] {self.name}: {self.text}"