mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-24 15:59:18 +00:00
Revert changes related to the Story.download
This commit is contained in:
parent
ce8de3c8dd
commit
5e5860534b
@ -674,6 +674,7 @@ def pyrogram_api():
|
||||
Story.reply_video_note
|
||||
Story.reply_voice
|
||||
Story.delete
|
||||
Story.download
|
||||
Story.edit_media
|
||||
Story.edit_caption
|
||||
Story.edit_privacy
|
||||
|
@ -63,7 +63,7 @@ class Story(Object, Update):
|
||||
media (:obj:`~pyrogram.enums.MessageMediaType`, *optional*):
|
||||
The media type of the Story.
|
||||
This field will contain the enumeration type of the media message.
|
||||
You can use ``media = getattr(message, message.story.media.value)`` to access the media message.
|
||||
You can use ``media = getattr(story, story.media.value)`` to access the media message.
|
||||
|
||||
has_protected_content (``bool``, *optional*):
|
||||
True, if the story can't be forwarded.
|
||||
@ -1733,6 +1733,81 @@ class Story(Object, Update):
|
||||
schedule_date=schedule_date
|
||||
)
|
||||
|
||||
async def download(
|
||||
self,
|
||||
file_name: str = "",
|
||||
in_memory: bool = False,
|
||||
block: bool = True,
|
||||
progress: Callable = None,
|
||||
progress_args: tuple = ()
|
||||
) -> str:
|
||||
"""Bound method *download* of :obj:`~pyrogram.types.Story`.
|
||||
|
||||
Use as a shortcut for:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
await client.download_media(story)
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
await story.download()
|
||||
|
||||
Parameters:
|
||||
file_name (``str``, *optional*):
|
||||
A custom *file_name* to be used instead of the one provided by Telegram.
|
||||
By default, all files are downloaded in the *downloads* folder in your working directory.
|
||||
You can also specify a path for downloading files in a custom location: paths that end with "/"
|
||||
are considered directories. All non-existent folders will be created automatically.
|
||||
|
||||
in_memory (``bool``, *optional*):
|
||||
Pass True to download the media in-memory.
|
||||
A binary file-like object with its attribute ".name" set will be returned.
|
||||
Defaults to False.
|
||||
|
||||
block (``bool``, *optional*):
|
||||
Blocks the code execution until the file has been downloaded.
|
||||
Defaults to True.
|
||||
|
||||
progress (``Callable``, *optional*):
|
||||
Pass a callback function to view the file transmission progress.
|
||||
The function must take *(current, total)* as positional arguments (look at Other Parameters below for a
|
||||
detailed description) and will be called back each time a new file chunk has been successfully
|
||||
transmitted.
|
||||
|
||||
progress_args (``tuple``, *optional*):
|
||||
Extra custom arguments for the progress callback function.
|
||||
You can pass anything you need to be available in the progress callback scope; for example, a Message
|
||||
object or a Client instance in order to edit the message with the updated progress status.
|
||||
|
||||
Other Parameters:
|
||||
current (``int``):
|
||||
The amount of bytes transmitted so far.
|
||||
|
||||
total (``int``):
|
||||
The total size of the file.
|
||||
|
||||
*args (``tuple``, *optional*):
|
||||
Extra custom arguments as defined in the ``progress_args`` parameter.
|
||||
You can either keep ``*args`` or add every single extra argument in your function signature.
|
||||
|
||||
Returns:
|
||||
On success, the absolute path of the downloaded file as string is returned, None otherwise.
|
||||
|
||||
Raises:
|
||||
RPCError: In case of a Telegram RPC error.
|
||||
``ValueError``: If the message doesn't contain any downloadable media
|
||||
"""
|
||||
return await self._client.download_media(
|
||||
message=getattr(self, self.media.value),
|
||||
file_name=file_name,
|
||||
in_memory=in_memory,
|
||||
block=block,
|
||||
progress=progress,
|
||||
progress_args=progress_args,
|
||||
)
|
||||
|
||||
async def read(self) -> List[int]:
|
||||
"""Bound method *read* of :obj:`~pyrogram.types.Story`.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user