mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 12:53:44 +03:00
Fix stringify for custom Message
This commit is contained in:
parent
56faccf151
commit
3b12cc3e51
|
@ -194,7 +194,7 @@ def pretty_print(obj, indent=None, max_depth=float('inf')):
|
||||||
if max_depth < 0:
|
if max_depth < 0:
|
||||||
return '...'
|
return '...'
|
||||||
|
|
||||||
to_d = getattr(obj, '_to_dict', None) or getattr(obj, 'to_dict', None)
|
to_d = getattr(obj, 'to_dict', None)
|
||||||
if callable(to_d):
|
if callable(to_d):
|
||||||
obj = to_d()
|
obj = to_d()
|
||||||
|
|
||||||
|
|
|
@ -1334,39 +1334,6 @@ class Message(ChatGetter, SenderGetter):
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return self._message.to_dict()
|
return self._message.to_dict()
|
||||||
|
|
||||||
def _to_dict(self):
|
|
||||||
return {
|
|
||||||
'_': 'Message',
|
|
||||||
'id': self.id,
|
|
||||||
'out': self.out,
|
|
||||||
'date': self.date,
|
|
||||||
'text': self.text,
|
|
||||||
'sender': self.sender,
|
|
||||||
'chat': self.chat,
|
|
||||||
'mentioned': self.mentioned,
|
|
||||||
'media_unread': self.media_unread,
|
|
||||||
'silent': self.silent,
|
|
||||||
'post': self.post,
|
|
||||||
'from_scheduled': self.from_scheduled,
|
|
||||||
'legacy': self.legacy,
|
|
||||||
'edit_hide': self.edit_hide,
|
|
||||||
'pinned': self.pinned,
|
|
||||||
'forward': self.forward,
|
|
||||||
'via_bot': self.via_bot,
|
|
||||||
'reply_to': self.reply_to,
|
|
||||||
'reply_markup': self.reply_markup,
|
|
||||||
'views': self.views,
|
|
||||||
'forwards': self.forwards,
|
|
||||||
'replies': self.replies,
|
|
||||||
'edit_date': self.edit_date,
|
|
||||||
'post_author': self.post_author,
|
|
||||||
'grouped_id': self.grouped_id,
|
|
||||||
'ttl_period': self.ttl_period,
|
|
||||||
'action': self.action,
|
|
||||||
'media': self.media,
|
|
||||||
'action_entities': self.action_entities,
|
|
||||||
}
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return helpers.pretty_print(self)
|
return helpers.pretty_print(self)
|
||||||
|
|
||||||
|
@ -1375,6 +1342,3 @@ class Message(ChatGetter, SenderGetter):
|
||||||
|
|
||||||
def stringify(self):
|
def stringify(self):
|
||||||
return helpers.pretty_print(self, indent=0)
|
return helpers.pretty_print(self, indent=0)
|
||||||
|
|
||||||
|
|
||||||
# TODO set md by default if commonmark is installed else nothing
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user