mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
parent
61e6e58be7
commit
42ea51cb77
@ -30,6 +30,7 @@ class SendDocument(BaseClient):
|
|||||||
def send_document(self,
|
def send_document(self,
|
||||||
chat_id: int or str,
|
chat_id: int or str,
|
||||||
document: str,
|
document: str,
|
||||||
|
thumb: str = None,
|
||||||
caption: str = "",
|
caption: str = "",
|
||||||
parse_mode: str = "",
|
parse_mode: str = "",
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
@ -51,6 +52,12 @@ class SendDocument(BaseClient):
|
|||||||
pass an HTTP URL as a string for Telegram to get a file from the Internet, or
|
pass an HTTP URL as a string for Telegram to get a file from the Internet, or
|
||||||
pass a file path as string to upload a new file that exists on your local machine.
|
pass a file path as string to upload a new file that exists on your local machine.
|
||||||
|
|
||||||
|
thumb (``str``):
|
||||||
|
Thumbnail of the file sent.
|
||||||
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
caption (``str``, *optional*):
|
caption (``str``, *optional*):
|
||||||
Document caption, 0-200 characters.
|
Document caption, 0-200 characters.
|
||||||
|
|
||||||
@ -103,10 +110,12 @@ class SendDocument(BaseClient):
|
|||||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||||
|
|
||||||
if os.path.exists(document):
|
if os.path.exists(document):
|
||||||
|
thumb = None if thumb is None else self.save_file(thumb)
|
||||||
file = self.save_file(document, progress=progress, progress_args=progress_args)
|
file = self.save_file(document, progress=progress, progress_args=progress_args)
|
||||||
media = types.InputMediaUploadedDocument(
|
media = types.InputMediaUploadedDocument(
|
||||||
mime_type=mimetypes.types_map.get("." + document.split(".")[-1], "text/plain"),
|
mime_type=mimetypes.types_map.get("." + document.split(".")[-1], "text/plain"),
|
||||||
file=file,
|
file=file,
|
||||||
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
types.DocumentAttributeFilename(os.path.basename(document))
|
types.DocumentAttributeFilename(os.path.basename(document))
|
||||||
]
|
]
|
||||||
|
@ -32,6 +32,7 @@ class SendVideoNote(BaseClient):
|
|||||||
video_note: str,
|
video_note: str,
|
||||||
duration: int = 0,
|
duration: int = 0,
|
||||||
length: int = 1,
|
length: int = 1,
|
||||||
|
thumb: str = None,
|
||||||
disable_notification: bool = None,
|
disable_notification: bool = None,
|
||||||
reply_to_message_id: int = None,
|
reply_to_message_id: int = None,
|
||||||
reply_markup=None,
|
reply_markup=None,
|
||||||
@ -57,6 +58,12 @@ class SendVideoNote(BaseClient):
|
|||||||
length (``int``, *optional*):
|
length (``int``, *optional*):
|
||||||
Video width and height.
|
Video width and height.
|
||||||
|
|
||||||
|
thumb (``str``, *optional*):
|
||||||
|
Thumbnail of the video sent.
|
||||||
|
The thumbnail should be in JPEG format and less than 200 KB in size.
|
||||||
|
A thumbnail's width and height should not exceed 90 pixels.
|
||||||
|
Thumbnails can't be reused and can be only uploaded as a new file.
|
||||||
|
|
||||||
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.
|
||||||
@ -100,10 +107,12 @@ class SendVideoNote(BaseClient):
|
|||||||
file = None
|
file = None
|
||||||
|
|
||||||
if os.path.exists(video_note):
|
if os.path.exists(video_note):
|
||||||
|
thumb = None if thumb is None else self.save_file(thumb)
|
||||||
file = self.save_file(video_note, progress=progress, progress_args=progress_args)
|
file = self.save_file(video_note, progress=progress, progress_args=progress_args)
|
||||||
media = types.InputMediaUploadedDocument(
|
media = types.InputMediaUploadedDocument(
|
||||||
mime_type=mimetypes.types_map[".mp4"],
|
mime_type=mimetypes.types_map[".mp4"],
|
||||||
file=file,
|
file=file,
|
||||||
|
thumb=thumb,
|
||||||
attributes=[
|
attributes=[
|
||||||
types.DocumentAttributeVideo(
|
types.DocumentAttributeVideo(
|
||||||
round_message=True,
|
round_message=True,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user