Fix send_file(force_document=True) for albums (closes #713)

This commit is contained in:
Lonami Exo 2018-03-21 09:46:57 +01:00
parent 3550974b71
commit f2407409b3

View File

@ -1399,12 +1399,15 @@ class TelegramClient(TelegramBareClient):
if utils.is_list_like(file): if utils.is_list_like(file):
# TODO Fix progress_callback # TODO Fix progress_callback
images = [] images = []
documents = [] if force_document:
for x in file: documents = file
if utils.is_image(x): else:
images.append(x) documents = []
else: for x in file:
documents.append(x) if utils.is_image(x):
images.append(x)
else:
documents.append(x)
result = [] result = []
while images: while images:
@ -1417,7 +1420,7 @@ class TelegramClient(TelegramBareClient):
result.extend( result.extend(
self.send_file( self.send_file(
entity, x, allow_cache=False, entity, x, allow_cache=allow_cache,
caption=caption, force_document=force_document, caption=caption, force_document=force_document,
progress_callback=progress_callback, reply_to=reply_to, progress_callback=progress_callback, reply_to=reply_to,
attributes=attributes, thumb=thumb, **kwargs attributes=attributes, thumb=thumb, **kwargs