From 09b16f96fc24e44a1e80e22d433dd8856d42dbc7 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 24 Nov 2018 20:30:10 +0100 Subject: [PATCH] Better behaviour for send_read_acknowledge --- telethon/client/messages.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/telethon/client/messages.py b/telethon/client/messages.py index d34a0efb..02dcba67 100644 --- a/telethon/client/messages.py +++ b/telethon/client/messages.py @@ -725,6 +725,9 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): This effectively marks a message as read (or more than one) in the given conversation. + If neither message nor maximum ID are provided, all messages will be + marked as read by assuming that ``max_id = 0``. + Args: entity (`entity`): The chat where these messages are located. @@ -744,14 +747,13 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): taken. """ if max_id is None: - if message: + if not message: + max_id = 0 + else: if utils.is_list_like(message): max_id = max(msg.id for msg in message) else: max_id = message.id - elif not clear_mentions: - raise ValueError( - 'Either a message list or a max_id must be provided.') entity = await self.get_input_entity(entity) if clear_mentions: