mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Add file_name param to file-related functions (#308)
This commit is contained in:
parent
22eb42e1f3
commit
0c83fa09a6
@ -38,6 +38,7 @@ class SendAnimation(BaseClient):
|
|||||||
width: int = 0,
|
width: int = 0,
|
||||||
height: int = 0,
|
height: int = 0,
|
||||||
thumb: str = None,
|
thumb: str = None,
|
||||||
|
file_name: str = None,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
schedule_date: int = None,
|
schedule_date: int = None,
|
||||||
@ -97,6 +98,10 @@ class SendAnimation(BaseClient):
|
|||||||
A thumbnail's width and height should not exceed 320 pixels.
|
A thumbnail's width and height should not exceed 320 pixels.
|
||||||
Thumbnails can't be reused and can be only uploaded as a new file.
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the animation sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
Users will receive a notification with no sound.
|
Users will receive a notification with no sound.
|
||||||
@ -172,7 +177,7 @@ class SendAnimation(BaseClient):
|
|||||||
w=width,
|
w=width,
|
||||||
h=height
|
h=height
|
||||||
),
|
),
|
||||||
types.DocumentAttributeFilename(file_name=os.path.basename(animation)),
|
types.DocumentAttributeFilename(file_name=file_name or os.path.basename(animation)),
|
||||||
types.DocumentAttributeAnimated()
|
types.DocumentAttributeAnimated()
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -37,6 +37,7 @@ class SendAudio(BaseClient):
|
|||||||
performer: str = None,
|
performer: str = None,
|
||||||
title: str = None,
|
title: str = None,
|
||||||
thumb: str = None,
|
thumb: str = None,
|
||||||
|
file_name: str = None,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
schedule_date: int = None,
|
schedule_date: int = None,
|
||||||
@ -94,6 +95,10 @@ class SendAudio(BaseClient):
|
|||||||
A thumbnail's width and height should not exceed 320 pixels.
|
A thumbnail's width and height should not exceed 320 pixels.
|
||||||
Thumbnails can't be reused and can be only uploaded as a new file.
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the audio sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
Users will receive a notification with no sound.
|
Users will receive a notification with no sound.
|
||||||
@ -171,7 +176,7 @@ class SendAudio(BaseClient):
|
|||||||
performer=performer,
|
performer=performer,
|
||||||
title=title
|
title=title
|
||||||
),
|
),
|
||||||
types.DocumentAttributeFilename(file_name=os.path.basename(audio))
|
types.DocumentAttributeFilename(file_name=file_name or os.path.basename(audio))
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
elif audio.startswith("http"):
|
elif audio.startswith("http"):
|
||||||
|
@ -34,6 +34,7 @@ class SendDocument(BaseClient):
|
|||||||
thumb: str = None,
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: Union[str, None] = object,
|
parse_mode: Union[str, None] = object,
|
||||||
|
file_name: str = None,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
schedule_date: int = None,
|
schedule_date: int = None,
|
||||||
@ -80,6 +81,10 @@ class SendDocument(BaseClient):
|
|||||||
Pass "html" to enable HTML-style parsing only.
|
Pass "html" to enable HTML-style parsing only.
|
||||||
Pass None to completely disable style parsing.
|
Pass None to completely disable style parsing.
|
||||||
|
|
||||||
|
file_name (``str``, *optional*):
|
||||||
|
File name of the document sent.
|
||||||
|
Defaults to file's path basename.
|
||||||
|
|
||||||
disable_notification (``bool``, *optional*):
|
disable_notification (``bool``, *optional*):
|
||||||
Sends the message silently.
|
Sends the message silently.
|
||||||
Users will receive a notification with no sound.
|
Users will receive a notification with no sound.
|
||||||
@ -146,7 +151,7 @@ class SendDocument(BaseClient):
|
|||||||
file=file,
|
file=file,
|
||||||
thumb=thumb,
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
types.DocumentAttributeFilename(file_name=os.path.basename(document))
|
types.DocumentAttributeFilename(file_name=file_name or os.path.basename(document))
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
elif document.startswith("http"):
|
elif document.startswith("http"):
|
||||||
|
@ -37,6 +37,7 @@ class SendVideo(BaseClient):
|
|||||||
width: int = 0,
|
width: int = 0,
|
||||||
height: int = 0,
|
height: int = 0,
|
||||||
thumb: str = None,
|
thumb: str = None,
|
||||||
|
file_name: str = None,
|
||||||
supports_streaming: bool = True,
|
supports_streaming: bool = True,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
@ -93,6 +94,10 @@ class SendVideo(BaseClient):
|
|||||||
A thumbnail's width and height should not exceed 320 pixels.
|
A thumbnail's width and height should not exceed 320 pixels.
|
||||||
Thumbnails can't be reused and can be only uploaded as a new file.
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
|
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.
|
||||||
Defaults to True.
|
Defaults to True.
|
||||||
@ -169,7 +174,7 @@ class SendVideo(BaseClient):
|
|||||||
w=width,
|
w=width,
|
||||||
h=height
|
h=height
|
||||||
),
|
),
|
||||||
types.DocumentAttributeFilename(file_name=os.path.basename(video))
|
types.DocumentAttributeFilename(file_name=file_name or os.path.basename(video))
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
elif video.startswith("http"):
|
elif video.startswith("http"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user