You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A custom *file_name* to be used instead of the one provided by Telegram.
368
+
By default, all files are downloaded in the *downloads* folder in your working directory.
369
+
You can also specify a path for downloading files in a custom location: paths that end with "/"
370
+
are considered directories. All non-existent folders will be created automatically.
371
+
372
+
in_memory (``bool``, *optional*):
373
+
Pass True to download the media in-memory.
374
+
A binary file-like object with its attribute ".name" set will be returned.
375
+
Defaults to False.
376
+
377
+
block (``bool``, *optional*):
378
+
Blocks the code execution until the file has been downloaded.
379
+
Defaults to True.
380
+
381
+
idx (``int``, *optional*):
382
+
In case of a :obj:`~pyrogram.types.PaidMediaInfo` with more than one ``paid_media``, the zero based index of the :obj:`~pyrogram.types.PaidMedia` to download. Raises ``IndexError`` if the index specified does not exist in the original ``message``.
383
+
384
+
progress (``Callable``, *optional*):
385
+
Pass a callback function to view the file transmission progress.
386
+
The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
387
+
detailed description) and will be called back each time a new file chunk has been successfully
388
+
transmitted.
389
+
390
+
progress_args (``tuple``, *optional*):
391
+
Extra custom arguments for the progress callback function.
392
+
You can pass anything you need to be available in the progress callback scope; for example, a Message
393
+
object or a Client instance in order to edit the message with the updated progress status.
394
+
395
+
Other Parameters:
396
+
current (``int``):
397
+
The amount of bytes transmitted so far.
398
+
399
+
total (``int``):
400
+
The total size of the file.
401
+
402
+
*args (``tuple``, *optional*):
403
+
Extra custom arguments as defined in the ``progress_args`` parameter.
404
+
You can either keep ``*args`` or add every single extra argument in your function signature.
405
+
406
+
Returns:
407
+
``str`` | ``None`` | :obj:`io.BytesIO`: On success, the absolute path of the downloaded file is returned,
408
+
otherwise, in case the download failed or was deliberately stopped with
409
+
:meth:`~pyrogram.Client.stop_transmission`, None is returned.
410
+
Otherwise, in case ``in_memory=True``, a binary file-like object with its attribute ".name" set is returned.
411
+
If the message is a :obj:`~pyrogram.types.PaidMediaInfo` with more than one ``paid_media`` containing ``minithumbnail`` and ``idx`` is not specified, then a list of paths or binary file-like objects is returned.
412
+
413
+
Raises:
414
+
RPCError: In case of a Telegram RPC error.
415
+
IndexError: In case of wrong value of ``idx``.
416
+
ValueError: If the message doesn't contain any downloadable media.
417
+
418
+
"""
419
+
message=getattr(self, self.media.value, None)
420
+
ifnotmessage:
421
+
raiseValueError(
422
+
f"The reply doesn't contain any downloadable media"
0 commit comments