From e12f6c747fea4be9004be139eb51695b78ddd7ed Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 26 Jul 2020 13:03:59 +0200 Subject: [PATCH] Extend use of force_document to work on files This allows .webp files to be sent as documents and not stickers. --- telethon/client/uploads.py | 3 ++- telethon/utils.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/telethon/client/uploads.py b/telethon/client/uploads.py index 19914ba5..2cf636dc 100644 --- a/telethon/client/uploads.py +++ b/telethon/client/uploads.py @@ -766,7 +766,8 @@ class UploadMethods: file=file_handle, mime_type=mime_type, attributes=attributes, - thumb=thumb + thumb=thumb, + force_file=force_document ) return file_handle, media, as_image diff --git a/telethon/utils.py b/telethon/utils.py index c8991724..c8faf5a6 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -483,7 +483,7 @@ def get_input_media( supports_streaming=supports_streaming ) return types.InputMediaUploadedDocument( - file=media, mime_type=mime, attributes=attrs) + file=media, mime_type=mime, attributes=attrs, force_file=force_document) if isinstance(media, types.MessageMediaGame): return types.InputMediaGame(id=types.InputGameID(