mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 02:43:45 +03:00
Fix return value of send_file(album) of the same media
This commit is contained in:
parent
57dd0827f4
commit
6817e19923
|
@ -164,7 +164,7 @@ class MessageParseMethods:
|
||||||
mapping = sched_to_message
|
mapping = sched_to_message
|
||||||
opposite = id_to_message # scheduled may be treated as normal, though
|
opposite = id_to_message # scheduled may be treated as normal, though
|
||||||
|
|
||||||
random_id = request if isinstance(request, int) else request.random_id
|
random_id = request if isinstance(request, (int, list)) else request.random_id
|
||||||
if not utils.is_list_like(random_id):
|
if not utils.is_list_like(random_id):
|
||||||
msg = mapping.get(random_to_id.get(random_id))
|
msg = mapping.get(random_to_id.get(random_id))
|
||||||
if not msg:
|
if not msg:
|
||||||
|
|
|
@ -395,25 +395,18 @@ class UploadMethods:
|
||||||
fm,
|
fm,
|
||||||
message=caption,
|
message=caption,
|
||||||
entities=msg_entities
|
entities=msg_entities
|
||||||
|
# random_id is autogenerated
|
||||||
))
|
))
|
||||||
|
|
||||||
# Now we can construct the multi-media request
|
# Now we can construct the multi-media request
|
||||||
result = await self(functions.messages.SendMultiMediaRequest(
|
request = functions.messages.SendMultiMediaRequest(
|
||||||
entity, reply_to_msg_id=reply_to, multi_media=media,
|
entity, reply_to_msg_id=reply_to, multi_media=media,
|
||||||
silent=silent, schedule_date=schedule
|
silent=silent, schedule_date=schedule
|
||||||
))
|
)
|
||||||
|
result = await self(request)
|
||||||
|
|
||||||
# We never sent a `random_id` for the messages that resulted from
|
random_ids = [m.random_id for m in media]
|
||||||
# the request so we can't pair them up with the `Updates` that we
|
return self._get_response_message(random_ids, result, entity)
|
||||||
# get from Telegram. However, the sent messages have a photo and
|
|
||||||
# the photo IDs match with those we did send.
|
|
||||||
#
|
|
||||||
# Updates -> {_: message}
|
|
||||||
messages = self._get_response_message(None, result, entity)
|
|
||||||
# {_: message} -> {photo ID: message}
|
|
||||||
messages = {m.photo.id: m for m in messages.values()}
|
|
||||||
# Sent photo IDs -> messages
|
|
||||||
return [messages[m.media.id.id] for m in media]
|
|
||||||
|
|
||||||
async def upload_file(
|
async def upload_file(
|
||||||
self: 'TelegramClient',
|
self: 'TelegramClient',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user