diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py index 01856a79..963d0681 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -201,7 +201,7 @@ class SendAnimation(Scaffold): thumb = await self.save_file(thumb) file = await self.save_file(animation, progress=progress, progress_args=progress_args) media = raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(animation.name) or "video/mp4", + mime_type=self.guess_mime_type(file_name or animation.name) or "video/mp4", file=file, thumb=thumb, attributes=[ @@ -211,7 +211,7 @@ class SendAnimation(Scaffold): w=width, h=height ), - raw.types.DocumentAttributeFilename(file_name=animation.name), + raw.types.DocumentAttributeFilename(file_name=file_name or animation.name), raw.types.DocumentAttributeAnimated() ] ) diff --git a/pyrogram/methods/messages/send_audio.py b/pyrogram/methods/messages/send_audio.py index 4ce02c31..921b7890 100644 --- a/pyrogram/methods/messages/send_audio.py +++ b/pyrogram/methods/messages/send_audio.py @@ -197,7 +197,7 @@ class SendAudio(Scaffold): thumb = await self.save_file(thumb) file = await self.save_file(audio, progress=progress, progress_args=progress_args) media = raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(audio.name) or "audio/mpeg", + mime_type=self.guess_mime_type(file_name or audio.name) or "audio/mpeg", file=file, thumb=thumb, attributes=[ @@ -206,7 +206,7 @@ class SendAudio(Scaffold): performer=performer, title=title ), - raw.types.DocumentAttributeFilename(file_name=audio.name) + raw.types.DocumentAttributeFilename(file_name=file_name or audio.name) ] ) diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py index bc407fe2..c3765a17 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -180,11 +180,11 @@ class SendDocument(Scaffold): thumb = await self.save_file(thumb) file = await self.save_file(document, progress=progress, progress_args=progress_args) media = raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(document.name) or "application/zip", + mime_type=self.guess_mime_type(file_name or document.name) or "application/zip", file=file, thumb=thumb, attributes=[ - raw.types.DocumentAttributeFilename(file_name=document.name) + raw.types.DocumentAttributeFilename(file_name=file_name or document.name) ] ) diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index cccc07ab..e9448a22 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -207,7 +207,7 @@ class SendVideo(Scaffold): thumb = await self.save_file(thumb) file = await self.save_file(video, progress=progress, progress_args=progress_args) media = raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(video.name) or "video/mp4", + mime_type=self.guess_mime_type(file_name or video.name) or "video/mp4", file=file, ttl_seconds=ttl_seconds, thumb=thumb, @@ -218,7 +218,7 @@ class SendVideo(Scaffold): w=width, h=height ), - raw.types.DocumentAttributeFilename(file_name=video.name) + raw.types.DocumentAttributeFilename(file_name=file_name or video.name) ] )