Merge branch 'pyrogram:master' into mtpager

This commit is contained in:
Sam 2022-01-11 23:45:20 +08:00 committed by GitHub
commit 08ec6528e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -51,13 +51,10 @@ class GetMediaGroup(Scaffold):
In case target message doesn't belong to a media group.
"""
# There can be maximum 10 items in a media group.
messages = await self.get_messages(chat_id, [msg_id for msg_id in range(message_id - 9, message_id + 10)],
replies=0)
if message_id <= 0:
raise ValueError("Passed message_id is negative or equal to zero.")
# Get messages with id from `id - 9` to `id + 10` to get all possible media group messages.
messages = await self.get_messages(
chat_id=chat_id,
message_ids=[msg_id for msg_id in range(message_id - 9, message_id + 10)],
@ -65,7 +62,7 @@ class GetMediaGroup(Scaffold):
)
# There can be maximum 10 items in a media group.
# The if/else condition to fix the problem of getting correct `media_group_id` when it has `message_id` less then 10.
# If/else condition to fix the problem of getting correct `media_group_id` when `message_id` is less than 10.
media_group_id = messages[9].media_group_id if len(messages) == 19 else messages[message_id - 1].media_group_id
if media_group_id is None:

View File

@ -50,6 +50,8 @@ class FutureSalts(TLObject):
b = BytesIO()
b.write(Int(self.ID, False))
b.write(Int(self.ID, False))
b.write(Long(self.req_msg_id))
b.write(Int(self.now))