mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-14 02:52:12 +00:00
Fix parsing date in Deserializable objects.
This commit is contained in:
parent
b2798e39a8
commit
33f7f0018e
4 changed files with 5 additions and 13 deletions
|
|
@ -59,6 +59,11 @@ class Deserializable:
|
||||||
result[name] = attr
|
result[name] = attr
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _parse_date(cls, unix_time):
|
||||||
|
if unix_time is not None:
|
||||||
|
return datetime.datetime.fromtimestamp(unix_time)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bot(self) -> 'Bot':
|
def bot(self) -> 'Bot':
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,6 @@ class ChatMember(Deserializable):
|
||||||
self.can_send_other_messages: bool = can_send_other_messages
|
self.can_send_other_messages: bool = can_send_other_messages
|
||||||
self.can_add_web_page_previews: bool = can_add_web_page_previews
|
self.can_add_web_page_previews: bool = can_add_web_page_previews
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def _parse_date(cls, unix_time):
|
|
||||||
if unix_time is not None:
|
|
||||||
return datetime.datetime.fromtimestamp(unix_time)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def de_json(cls, raw_data):
|
def de_json(cls, raw_data):
|
||||||
user = User.deserialize(raw_data.get('user'))
|
user = User.deserialize(raw_data.get('user'))
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,6 @@ class Message(Deserializable):
|
||||||
|
|
||||||
self.content_type = content_type
|
self.content_type = content_type
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def _parse_date(cls, unix_time):
|
|
||||||
return datetime.datetime.fromtimestamp(unix_time)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def de_json(cls, raw_data):
|
def de_json(cls, raw_data):
|
||||||
message_id = raw_data.get('message_id')
|
message_id = raw_data.get('message_id')
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,6 @@ class WebhookInfo(Deserializable):
|
||||||
self.max_connections: int = max_connections
|
self.max_connections: int = max_connections
|
||||||
self.allowed_updates: [str] = allowed_updates
|
self.allowed_updates: [str] = allowed_updates
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def _parse_date(cls, unix_time):
|
|
||||||
return datetime.datetime.fromtimestamp(unix_time)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def de_json(cls, raw_data):
|
def de_json(cls, raw_data):
|
||||||
url = raw_data.get('url')
|
url = raw_data.get('url')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue