From cdabf3e7e06afacc7e217a45013cc2fa6b3cc86b Mon Sep 17 00:00:00 2001 From: Vankineeni Tawrun Date: Thu, 8 Nov 2018 19:08:56 +0530 Subject: [PATCH] added args to Message.download bound method --- .../client/types/messages_and_media/message.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index ffcab6f3..ee812c3a 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -634,7 +634,7 @@ class Message(Object): else: 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 `. Use as a shortcut for: @@ -659,6 +659,15 @@ class Message(Object): Blocks the code execution until the file has been downloaded. 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: 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( message=self, file_name=file_name, - block=block + block=block, + progress=progress, + progress_args=progress_args, )