Add option to clear unread reactions in send_read_acknowledge

This commit is contained in:
Tulir Asokan 2022-04-01 15:54:28 +03:00 committed by Lonami Exo
parent dda696cce4
commit ecc036c7f4

View File

@ -1277,7 +1277,8 @@ class MessageMethods:
message: 'typing.Union[hints.MessageIDLike, typing.Sequence[hints.MessageIDLike]]' = None,
*,
max_id: int = None,
clear_mentions: bool = False) -> bool:
clear_mentions: bool = False,
clear_reactions: bool = False) -> bool:
"""
Marks messages as read and optionally clears mentions.
@ -1311,6 +1312,13 @@ class MessageMethods:
If no message is provided, this will be the only action
taken.
clear_reactions (`bool`):
Whether the reactions badge should be cleared (so that
there are no more reaction notifications) or not for the given entity.
If no message is provided, this will be the only action
taken.
Example
.. code-block:: python
@ -1333,6 +1341,10 @@ class MessageMethods:
entity = await self.get_input_entity(entity)
if clear_mentions:
await self(functions.messages.ReadMentionsRequest(entity))
if max_id is None and not clear_reactions:
return True
if clear_reactions:
await self(functions.messages.ReadReactionsRequest(entity))
if max_id is None:
return True