From 572229e536b711d157b119f8a128affe1a355155 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 1 Oct 2020 20:37:07 +0200 Subject: [PATCH] Add aliases to access new msg fields with old names --- telethon/tl/custom/message.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index a11f2dce..5ea95730 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -597,6 +597,22 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC): """ return self._via_input_bot + @property + def reply_to_msg_id(self): + """ + Returns the message ID this message is replying to, if any. + 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 + + @property + def to_id(self): + """ + Alias for ``.peer_id``. Telegram renamed the field, and this property + exists to avoid breaking code. + """ + return self.peer_id + # endregion Public Properties # region Public Methods