From 15b6fbc1c4c98537bdd5f4731c36f6bc089f047a Mon Sep 17 00:00:00 2001 From: PUJA <52121207+krypton-byte@users.noreply.github.com> Date: Wed, 15 May 2024 09:56:00 +0700 Subject: [PATCH] Update client.py --- neonize/client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neonize/client.py b/neonize/client.py index c57278e..7d41420 100644 --- a/neonize/client.py +++ b/neonize/client.py @@ -972,6 +972,7 @@ def build_document_message( caption: Optional[str] = None, title: Optional[str] = None, filename: Optional[str] = None, + mimetype: Optional[str] = None, quoted: Optional[neonize_proto.Message] = None, ): io = BytesIO(get_bytes_from_name_or_url(file)) @@ -987,9 +988,7 @@ def build_document_message( fileLength=upload.FileLength, fileSha256=upload.FileSHA256, mediaKey=upload.MediaKey, - mimetype=magic.from_buffer(buff, mime=True).replace( - "application", "document" - ), + mimetype=mimetype or magic.from_buffer(buff, mime=True), title=title, fileName=filename, contextInfo=ContextInfo( @@ -1010,6 +1009,7 @@ def send_document( caption: Optional[str] = None, title: Optional[str] = None, filename: Optional[str] = None, + mimetype: Optional[str] = None, quoted: Optional[neonize_proto.Message] = None, ) -> SendResponse: """Sends a document to the specified recipient. @@ -1030,7 +1030,7 @@ def send_document( :rtype: SendResponse """ return self.send_message( - to, self.build_document_message(file, caption, title, filename, quoted) + to, self.build_document_message(file, caption, title, filename, mimetype, quoted) ) def send_contact(