forked from CustomIcon/intellivoid-spam-protection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.py
31 lines (26 loc) · 927 Bytes
/
types.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
from datetime import datetime
from .utils import attrdict
class SPB:
def __str__(self) -> str:
return f"<{self.__class__.__name__}: {self.__dict__}>"
def __repr__(self) -> str:
return self.__str__()
class Blacklist(SPB):
def __init__(
self,
success: bool,
response_code: int,
results=dict,
**kwargs
):
self.success = success
self.response_code = response_code
try:
self.private_telegram_id = results["private_telegram_id"]
self.entity_type = results["entity_type"]
self.attributes = attrdict(results["attributes"])
self.language_prediction = attrdict(results["language_prediction"])
self.spam_prediction = attrdict(results["spam_prediction"])
self.last_updated = datetime.fromtimestamp(results["last_updated"])
except TypeError:
pass