From d290a569c58625f67fc47930062725e40c161360 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 13 Nov 2016 14:51:50 +0100 Subject: [PATCH] Added webp mime type (useful when downloading stickers) --- telethon/utils/tl_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/telethon/utils/tl_utils.py b/telethon/utils/tl_utils.py index d9a8a20a..71714f69 100644 --- a/telethon/utils/tl_utils.py +++ b/telethon/utils/tl_utils.py @@ -2,7 +2,7 @@ We have these because some TLObjects differ in very little things, for example, some may have an `user_id` attribute and other a `chat_id` but, after all, both are the same attribute, IDs.""" -from mimetypes import guess_extension +from mimetypes import add_type, guess_extension from telethon.tl.types import \ User, Chat, Channel, \ @@ -23,6 +23,9 @@ def get_display_name(entity): if isinstance(entity, Chat) or isinstance(entity, Channel): return entity.title +# For some reason, .webp (stickers' format) is not registered +add_type('image/webp', '.webp') + def get_extension(media): """Gets the corresponding extension for any Telegram media"""