Add force_document argument for send_document

This commit is contained in:
Dan 2020-08-29 15:50:36 +02:00
parent 92bc59e688
commit c689273167

View File

@ -38,6 +38,7 @@ class SendDocument(Scaffold):
caption: str = "", caption: str = "",
parse_mode: Union[str, None] = object, parse_mode: Union[str, None] = object,
file_name: str = None, file_name: str = None,
force_document: bool = 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,
@ -89,6 +90,11 @@ class SendDocument(Scaffold):
File name of the document sent. File name of the document sent.
Defaults to file's path basename. 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*): 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.
@ -157,7 +163,7 @@ class SendDocument(Scaffold):
media = raw.types.InputMediaUploadedDocument( media = raw.types.InputMediaUploadedDocument(
mime_type=self.guess_mime_type(document) or "application/zip", mime_type=self.guess_mime_type(document) or "application/zip",
file=file, file=file,
force_file=True, force_file=force_document or None,
thumb=thumb, thumb=thumb,
attributes=[ attributes=[
raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(document)) raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(document))