mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-17 03:51:05 +03:00
Fix .send_read_acknowledge() for channels (#501)
This commit is contained in:
parent
73edb0f4ff
commit
f3d47769df
|
@ -558,13 +558,13 @@ class TelegramClient(TelegramBareClient):
|
||||||
|
|
||||||
return total_messages, messages, senders
|
return total_messages, messages, senders
|
||||||
|
|
||||||
def send_read_acknowledge(self, entity, messages=None, max_id=None):
|
def send_read_acknowledge(self, entity, message=None, max_id=None):
|
||||||
"""
|
"""
|
||||||
Sends a "read acknowledge" (i.e., notifying the given peer that we've
|
Sends a "read acknowledge" (i.e., notifying the given peer that we've
|
||||||
read their messages, also known as the "double check").
|
read their messages, also known as the "double check").
|
||||||
|
|
||||||
:param entity: The chat where these messages are located.
|
:param entity: The chat where these messages are located.
|
||||||
:param messages: Either a list of messages or a single message.
|
:param message: Either a list of messages or a single message.
|
||||||
:param max_id: Overrides messages, until which message should the
|
:param max_id: Overrides messages, until which message should the
|
||||||
acknowledge should be sent.
|
acknowledge should be sent.
|
||||||
:return:
|
:return:
|
||||||
|
@ -574,15 +574,16 @@ class TelegramClient(TelegramBareClient):
|
||||||
raise InvalidParameterError(
|
raise InvalidParameterError(
|
||||||
'Either a message list or a max_id must be provided.')
|
'Either a message list or a max_id must be provided.')
|
||||||
|
|
||||||
if isinstance(messages, list):
|
if hasattr(message, '__iter__'):
|
||||||
max_id = max(msg.id for msg in messages)
|
max_id = max(msg.id for msg in message)
|
||||||
else:
|
else:
|
||||||
max_id = messages.id
|
max_id = message.id
|
||||||
|
|
||||||
return self(ReadHistoryRequest(
|
entity = self.get_input_entity(entity)
|
||||||
peer=self.get_input_entity(entity),
|
if entity == InputPeerChannel:
|
||||||
max_id=max_id
|
return self(channels.ReadHistoryRequest(entity, max_id=max_id))
|
||||||
))
|
else:
|
||||||
|
return self(messages.ReadHistoryRequest(entity, max_id=max_id))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_reply_to(reply_to):
|
def _get_reply_to(reply_to):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user