From 010ee0813a73b8c0e7748b9e91b0b3d9f3d76748 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 16 Oct 2021 14:01:56 +0200 Subject: [PATCH] Rename send_read_acknowledge --- readthedocs/misc/v2-migration-guide.rst | 2 ++ telethon/_client/messages.py | 2 +- telethon/_client/telegramclient.py | 10 +++++----- telethon/_events/album.py | 6 +++--- telethon/types/_custom/message.py | 6 +++--- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/readthedocs/misc/v2-migration-guide.rst b/readthedocs/misc/v2-migration-guide.rst index 0b6a7c01..774e8634 100644 --- a/readthedocs/misc/v2-migration-guide.rst +++ b/readthedocs/misc/v2-migration-guide.rst @@ -716,3 +716,5 @@ size selector for download_profile_photo and download_media is now different still thumb because otherwise documents are weird. keep support for explicit size instance? + +renamed send_read_acknowledge. add send_read_acknowledge as alias for mark_read? diff --git a/telethon/_client/messages.py b/telethon/_client/messages.py index 4a5ae371..f55fed8d 100644 --- a/telethon/_client/messages.py +++ b/telethon/_client/messages.py @@ -667,7 +667,7 @@ async def delete_messages( return sum(r.pts_count for r in res) -async def send_read_acknowledge( +async def mark_read( self: 'TelegramClient', entity: 'hints.EntityLike', message: 'typing.Union[hints.MessageIDLike, typing.Sequence[hints.MessageIDLike]]' = None, diff --git a/telethon/_client/telegramclient.py b/telethon/_client/telegramclient.py index e9ea9ca9..f6ad961b 100644 --- a/telethon/_client/telegramclient.py +++ b/telethon/_client/telegramclient.py @@ -2490,8 +2490,8 @@ class TelegramClient: await client.delete_messages(chat, messages) """ - @forward_call(messages.send_read_acknowledge) - async def send_read_acknowledge( + @forward_call(messages.mark_read) + async def mark_read( self: 'TelegramClient', entity: 'hints.EntityLike', message: 'typing.Union[hints.MessageIDLike, typing.Sequence[hints.MessageIDLike]]' = None, @@ -2535,11 +2535,11 @@ class TelegramClient: .. code-block:: python # using a Message object - await client.send_read_acknowledge(chat, message) + await client.mark_read(chat, message) # ...or using the int ID of a Message - await client.send_read_acknowledge(chat, message_id) + await client.mark_read(chat, message_id) # ...or passing a list of messages to mark as read - await client.send_read_acknowledge(chat, messages) + await client.mark_read(chat, messages) """ @forward_call(messages.pin_message) diff --git a/telethon/_events/album.py b/telethon/_events/album.py index cb9c39a8..19ea4234 100644 --- a/telethon/_events/album.py +++ b/telethon/_events/album.py @@ -310,12 +310,12 @@ class Album(EventBuilder): async def mark_read(self): """ Marks the entire album as read. Shorthand for - `client.send_read_acknowledge() - ` + `client.mark_read() + ` with both ``entity`` and ``message`` already set. """ if self._client: - await self._client.send_read_acknowledge( + await self._client.mark_read( await self.get_input_chat(), max_id=self.messages[-1].id) async def pin(self, *, notify=False): diff --git a/telethon/types/_custom/message.py b/telethon/types/_custom/message.py index bd0b61ee..278bc0e7 100644 --- a/telethon/types/_custom/message.py +++ b/telethon/types/_custom/message.py @@ -1237,12 +1237,12 @@ class Message(ChatGetter, SenderGetter): async def mark_read(self): """ Marks the message as read. Shorthand for - `client.send_read_acknowledge() - ` + `client.mark_read() + ` with both ``entity`` and ``message`` already set. """ if self._client: - await self._client.send_read_acknowledge( + await self._client.mark_read( await self.get_input_chat(), max_id=self.id) async def pin(self, *, notify=False, pm_oneside=False):