mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-16 01:56:41 +00:00
Handle cases when Message.reply_to is MessageReplyStoryHeader
This commit is contained in:
parent
7b00d2f510
commit
31e8ceeecc
@ -96,7 +96,7 @@ class Message(ChatGetter, SenderGetter, TLObject):
|
|||||||
The ID of the bot used to send this message
|
The ID of the bot used to send this message
|
||||||
through its inline mode (e.g. "via @like").
|
through its inline mode (e.g. "via @like").
|
||||||
|
|
||||||
reply_to (:tl:`MessageReplyHeader`):
|
reply_to (:tl:`MessageReplyHeader` | :tl:`MessageReplyStoryHeader`):
|
||||||
The original reply header if this message is replying to another.
|
The original reply header if this message is replying to another.
|
||||||
|
|
||||||
date (`datetime`):
|
date (`datetime`):
|
||||||
@ -379,10 +379,11 @@ class Message(ChatGetter, SenderGetter, TLObject):
|
|||||||
@property
|
@property
|
||||||
def is_reply(self):
|
def is_reply(self):
|
||||||
"""
|
"""
|
||||||
`True` if the message is a reply to some other message.
|
`True` if the message is a reply to some other message or story.
|
||||||
|
|
||||||
Remember that you can access the ID of the message
|
Remember that if the replied-to is a message,
|
||||||
this one is replying to through `reply_to.reply_to_msg_id`,
|
you can access the ID of the message this one is
|
||||||
|
replying to through `reply_to.reply_to_msg_id`,
|
||||||
and the `Message` object with `get_reply_message()`.
|
and the `Message` object with `get_reply_message()`.
|
||||||
"""
|
"""
|
||||||
return self.reply_to is not None
|
return self.reply_to is not None
|
||||||
@ -671,7 +672,11 @@ class Message(ChatGetter, SenderGetter, TLObject):
|
|||||||
Returns the message ID this message is replying to, if any.
|
Returns the message ID this message is replying to, if any.
|
||||||
This is equivalent to accessing ``.reply_to.reply_to_msg_id``.
|
This is equivalent to accessing ``.reply_to.reply_to_msg_id``.
|
||||||
"""
|
"""
|
||||||
return self.reply_to.reply_to_msg_id if self.reply_to else None
|
return (
|
||||||
|
self.reply_to.reply_to_msg_id
|
||||||
|
if isinstance(self.reply_to, types.MessageReplyHeader)
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def to_id(self):
|
def to_id(self):
|
||||||
@ -737,7 +742,7 @@ class Message(ChatGetter, SenderGetter, TLObject):
|
|||||||
The result will be cached after its first use.
|
The result will be cached after its first use.
|
||||||
"""
|
"""
|
||||||
if self._reply_message is None and self._client:
|
if self._reply_message is None and self._client:
|
||||||
if not self.reply_to:
|
if not isinstance(self.reply_to, types.MessageReplyHeader):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Bots cannot access other bots' messages by their ID.
|
# Bots cannot access other bots' messages by their ID.
|
||||||
|
Loading…
Reference in New Issue
Block a user