2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Add file_name parameter in edit_message_media method (#440)

* ability to change file_name in editmessagemedia method

* ability to change file_name in editmessagemedia method

* ability to change file_name in editmessagemedia method

* Update edit_message_media.py

* Update input_media_document.py

Co-authored-by: GadzhievSA <s.gadzhiev@id-mt.ru>
Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
Said 2020-07-27 16:21:42 +03:00 committed by GitHub
parent b16c5d5fa3
commit d3a34f1084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,8 @@ class EditMessageMedia(BaseClient):
chat_id: Union[int, str], chat_id: Union[int, str],
message_id: int, message_id: int,
media: InputMedia, media: InputMedia,
reply_markup: "pyrogram.InlineKeyboardMarkup" = None reply_markup: "pyrogram.InlineKeyboardMarkup" = None,
file_name: str = None
) -> "pyrogram.Message": ) -> "pyrogram.Message":
"""Edit animation, audio, document, photo or video messages. """Edit animation, audio, document, photo or video messages.
@ -58,6 +59,10 @@ class EditMessageMedia(BaseClient):
reply_markup (:obj:`InlineKeyboardMarkup`, *optional*): reply_markup (:obj:`InlineKeyboardMarkup`, *optional*):
An InlineKeyboardMarkup object. An InlineKeyboardMarkup object.
file_name (``str``, *optional*):
File name of the media to be sent. Not applicable to photos.
Defaults to file's path basename.
Returns: Returns:
:obj:`Message`: On success, the edited message is returned. :obj:`Message`: On success, the edited message is returned.
@ -119,7 +124,7 @@ class EditMessageMedia(BaseClient):
h=media.height h=media.height
), ),
types.DocumentAttributeFilename( types.DocumentAttributeFilename(
file_name=os.path.basename(media.media) file_name=file_name or os.path.basename(media.media)
) )
] ]
) )
@ -155,7 +160,7 @@ class EditMessageMedia(BaseClient):
title=media.title title=media.title
), ),
types.DocumentAttributeFilename( types.DocumentAttributeFilename(
file_name=os.path.basename(media.media) file_name=file_name or os.path.basename(media.media)
) )
] ]
) )
@ -192,7 +197,7 @@ class EditMessageMedia(BaseClient):
h=media.height h=media.height
), ),
types.DocumentAttributeFilename( types.DocumentAttributeFilename(
file_name=os.path.basename(media.media) file_name=file_name or os.path.basename(media.media)
), ),
types.DocumentAttributeAnimated() types.DocumentAttributeAnimated()
] ]
@ -224,7 +229,7 @@ class EditMessageMedia(BaseClient):
file=self.save_file(media.media), file=self.save_file(media.media),
attributes=[ attributes=[
types.DocumentAttributeFilename( types.DocumentAttributeFilename(
file_name=os.path.basename(media.media) file_name=file_name or os.path.basename(media.media)
) )
] ]
) )