2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-23 18:37:26 +00:00

Merge pull request #156 from VANKINEENITAWRUN/develop

Add missing args to Message.download bound method
This commit is contained in:
Dan 2018-11-08 20:30:39 +01:00 committed by GitHub
commit 3adb820bac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -634,7 +634,7 @@ class Message(Object):
else: else:
raise ValueError("The message doesn't contain any keyboard") raise ValueError("The message doesn't contain any keyboard")
def download(self, file_name: str = "", block: bool = True): def download(self, file_name: str = "", block: bool = True, progress: callable = None, progress_args: tuple = None):
"""Bound method *download* of :obj:`Message <pyrogram.Message>`. """Bound method *download* of :obj:`Message <pyrogram.Message>`.
Use as a shortcut for: Use as a shortcut for:
@ -659,6 +659,15 @@ class Message(Object):
Blocks the code execution until the file has been downloaded. Blocks the code execution until the file has been downloaded.
Defaults to True. Defaults to True.
progress (``callable``):
Pass a callback function to view the download progress.
The function must take *(client, current, total, \*args)* as positional arguments (look at the section
below for a detailed description).
progress_args (``tuple``):
Extra custom arguments for the progress callback function. Useful, for example, if you want to pass
a chat_id and a message_id in order to edit a message with the updated progress.
Returns: Returns:
On success, the absolute path of the downloaded file as string is returned, None otherwise. On success, the absolute path of the downloaded file as string is returned, None otherwise.
@ -669,5 +678,7 @@ class Message(Object):
return self._client.download_media( return self._client.download_media(
message=self, message=self,
file_name=file_name, file_name=file_name,
block=block block=block,
progress=progress,
progress_args=progress_args,
) )