mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add file_name param on InputMedia
* Add file_name param on InputMedia Add file_name param on: - InputMediaVideo - InputMediaAudio - InputMediaDocument --------- Co-authored-by: KurimuzonAkuma <31959970+KurimuzonAkuma@users.noreply.github.com> Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
b35123c93e
commit
eb9954a5cf
4 changed files with 26 additions and 8 deletions
|
|
@ -271,7 +271,7 @@ class SendMediaGroup:
|
||||||
w=i.width,
|
w=i.width,
|
||||||
h=i.height
|
h=i.height
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or os.path.basename(i.media)),
|
||||||
]
|
]
|
||||||
if is_animation:
|
if is_animation:
|
||||||
attributes.append(raw.types.DocumentAttributeAnimated())
|
attributes.append(raw.types.DocumentAttributeAnimated())
|
||||||
|
|
@ -339,7 +339,7 @@ class SendMediaGroup:
|
||||||
w=i.width,
|
w=i.width,
|
||||||
h=i.height
|
h=i.height
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "video.mp4")),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or getattr(i.media, "name", "video.mp4")),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -371,7 +371,7 @@ class SendMediaGroup:
|
||||||
performer=i.performer,
|
performer=i.performer,
|
||||||
title=i.title
|
title=i.title
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or os.path.basename(i.media)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -419,7 +419,7 @@ class SendMediaGroup:
|
||||||
performer=i.performer,
|
performer=i.performer,
|
||||||
title=i.title
|
title=i.title
|
||||||
),
|
),
|
||||||
raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "audio.mp3")),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or getattr(i.media, "name", "audio.mp3")),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -445,7 +445,7 @@ class SendMediaGroup:
|
||||||
file=file,
|
file=file,
|
||||||
thumb=thumb,
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or os.path.basename(i.media)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -490,7 +490,7 @@ class SendMediaGroup:
|
||||||
file=file,
|
file=file,
|
||||||
thumb=thumb,
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "file.zip")),
|
raw.types.DocumentAttributeFilename(file_name=i.file_name or getattr(i.media, "name", "file.zip")),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ class InputMediaAudio(InputMedia):
|
||||||
|
|
||||||
title (``str``, *optional*):
|
title (``str``, *optional*):
|
||||||
Title of the audio
|
Title of the audio
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the audio sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -73,7 +77,8 @@ class InputMediaAudio(InputMedia):
|
||||||
caption_entities: List[MessageEntity] = None,
|
caption_entities: List[MessageEntity] = None,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
performer: str = "",
|
performer: str = "",
|
||||||
title: str = ""
|
title: str = "",
|
||||||
|
file_name: str = None
|
||||||
):
|
):
|
||||||
super().__init__(media, caption, parse_mode, caption_entities)
|
super().__init__(media, caption, parse_mode, caption_entities)
|
||||||
|
|
||||||
|
|
@ -81,3 +86,4 @@ class InputMediaAudio(InputMedia):
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
self.performer = performer
|
self.performer = performer
|
||||||
self.title = title
|
self.title = title
|
||||||
|
self.file_name = file_name
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,10 @@ class InputMediaDocument(InputMedia):
|
||||||
|
|
||||||
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||||
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
|
List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the document sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -59,8 +63,10 @@ class InputMediaDocument(InputMedia):
|
||||||
thumb: str = None,
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: Optional["enums.ParseMode"] = None,
|
parse_mode: Optional["enums.ParseMode"] = None,
|
||||||
caption_entities: List[MessageEntity] = None
|
caption_entities: List[MessageEntity] = None,
|
||||||
|
file_name: str = None
|
||||||
):
|
):
|
||||||
super().__init__(media, caption, parse_mode, caption_entities)
|
super().__init__(media, caption, parse_mode, caption_entities)
|
||||||
|
|
||||||
self.thumb = thumb
|
self.thumb = thumb
|
||||||
|
self.file_name = file_name
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ class InputMediaVideo(InputMedia):
|
||||||
duration (``int``, *optional*):
|
duration (``int``, *optional*):
|
||||||
Video duration.
|
Video duration.
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the video sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
|
|
||||||
supports_streaming (``bool``, *optional*):
|
supports_streaming (``bool``, *optional*):
|
||||||
Pass True, if the uploaded video is suitable for streaming.
|
Pass True, if the uploaded video is suitable for streaming.
|
||||||
|
|
||||||
|
|
@ -79,6 +83,7 @@ class InputMediaVideo(InputMedia):
|
||||||
width: int = 0,
|
width: int = 0,
|
||||||
height: int = 0,
|
height: int = 0,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
|
file_name: str = None,
|
||||||
supports_streaming: bool = True,
|
supports_streaming: bool = True,
|
||||||
has_spoiler: bool = None,
|
has_spoiler: bool = None,
|
||||||
):
|
):
|
||||||
|
|
@ -88,5 +93,6 @@ class InputMediaVideo(InputMedia):
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
|
self.file_name = file_name
|
||||||
self.supports_streaming = supports_streaming
|
self.supports_streaming = supports_streaming
|
||||||
self.has_spoiler = has_spoiler
|
self.has_spoiler = has_spoiler
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue