From c689273167d6cb23ba881edfd32ed12e2321bdb7 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 29 Aug 2020 15:50:36 +0200 Subject: [PATCH] Add force_document argument for send_document --- pyrogram/methods/messages/send_document.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py index 0e5203da..0ee814a5 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -38,6 +38,7 @@ class SendDocument(Scaffold): caption: str = "", parse_mode: Union[str, None] = object, file_name: str = None, + force_document: bool = None, disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, @@ -89,6 +90,11 @@ class SendDocument(Scaffold): File name of the document sent. Defaults to file's path basename. + force_document (``bool``, *optional*): + Pass True to force sending files as document. Useful for video files that need to be sent as + document messages instead of video messages. + Defaults to False. + disable_notification (``bool``, *optional*): Sends the message silently. Users will receive a notification with no sound. @@ -157,7 +163,7 @@ class SendDocument(Scaffold): media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(document) or "application/zip", file=file, - force_file=True, + force_file=force_document or None, thumb=thumb, attributes=[ raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(document))