mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Small fixes
This commit is contained in:
parent
0d6af5bc8d
commit
cc8511284f
3 changed files with 6 additions and 2 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import datetime
|
||||
import json
|
||||
import time
|
||||
|
||||
|
||||
class Serializable:
|
||||
|
|
@ -26,6 +28,8 @@ class Deserializable:
|
|||
continue
|
||||
if hasattr(attr, 'to_json'):
|
||||
attr = getattr(attr, 'to_json')()
|
||||
elif isinstance(attr, datetime.datetime):
|
||||
attr = int(time.mktime(attr.timetuple()))
|
||||
result[item] = attr
|
||||
return result
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from . import Deserializable
|
|||
|
||||
|
||||
class CallbackQuery(Deserializable):
|
||||
__slots__ = ('id', 'from', 'message', 'inline_message_id', 'chat_instance', 'data', 'game_short_name')
|
||||
__slots__ = ('id', 'from_user', 'message', 'inline_message_id', 'chat_instance', 'data', 'game_short_name')
|
||||
|
||||
def __init__(self, id, from_user, message, inline_message_id, chat_instance, data, game_short_name):
|
||||
self.data = data
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from .user import User
|
|||
|
||||
class Message(Deserializable):
|
||||
__slots__ = (
|
||||
'message_id', 'from', 'date', 'chat', 'forward_from', 'forward_from_chat', 'forward_from_message_id',
|
||||
'message_id', 'from_user', 'date', 'chat', 'forward_from', 'forward_from_chat', 'forward_from_message_id',
|
||||
'forward_date', 'reply_to_message', 'edit_date', 'text', 'entities', 'audio', 'document', 'game', 'photo',
|
||||
'sticker', 'video', 'voice', 'video_note', 'new_chat_members', 'caption', 'contact', 'location', 'venue',
|
||||
'new_chat_member', 'left_chat_member', 'new_chat_title', 'new_chat_photo', 'delete_chat_photo',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue