From 8114fb6c9b7bfa50737e8f9b083a1227e1c83a34 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 18 Sep 2021 13:34:21 +0200 Subject: [PATCH] Stop checking fwd_from or not out in message.edit --- readthedocs/misc/v2-migration-guide.rst | 11 +++++++++++ telethon/types/_custom/message.py | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/readthedocs/misc/v2-migration-guide.rst b/readthedocs/misc/v2-migration-guide.rst index 8c014498..b28cf2bf 100644 --- a/readthedocs/misc/v2-migration-guide.rst +++ b/readthedocs/misc/v2-migration-guide.rst @@ -362,6 +362,17 @@ perform a separate request with no filter to fetch the total without filter (thi library used to do). +Using message.edit will now raise an error if the message cannot be edited +-------------------------------------------------------------------------- + +Before, calling ``message.edit()`` would completely ignore your attempt to edit a message if the +message had a forward header or was not outgoing. This is no longer the case. It is now the user's +responsibility to check for this. + +However, most likely, you were already doing the right thing (or else you would've experienced a +"why is this not being edited", which you would most likely consider a bug rather than a feature). + + The TelegramClient is no longer made out of mixins -------------------------------------------------- diff --git a/telethon/types/_custom/message.py b/telethon/types/_custom/message.py index 88a1a615..2d8f3fbe 100644 --- a/telethon/types/_custom/message.py +++ b/telethon/types/_custom/message.py @@ -762,9 +762,6 @@ class Message(ChatGetter, SenderGetter): `telethon.client.messages.MessageMethods.edit_message` with both ``entity`` and ``message`` already set. - Returns `None` if the message was incoming, - or the edited `Message` otherwise. - .. note:: This is different from `client.edit_message @@ -777,9 +774,6 @@ class Message(ChatGetter, SenderGetter): This is generally the most desired and convenient behaviour, and will work for link previews and message buttons. """ - if self.fwd_from or not self.out or not self._client: - return None # We assume self.out was patched for our chat - if 'link_preview' not in kwargs: kwargs['link_preview'] = bool(self.web_preview)