Added webp mime type (useful when downloading stickers)

This commit is contained in:
Lonami Exo 2016-11-13 14:51:50 +01:00
parent 308adc4192
commit d290a569c5

View File

@ -2,7 +2,7 @@
We have these because some TLObjects differ in very little things, 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, for example, some may have an `user_id` attribute and other a `chat_id` but,
after all, both are the same attribute, IDs.""" 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 \ from telethon.tl.types import \
User, Chat, Channel, \ User, Chat, Channel, \
@ -23,6 +23,9 @@ def get_display_name(entity):
if isinstance(entity, Chat) or isinstance(entity, Channel): if isinstance(entity, Chat) or isinstance(entity, Channel):
return entity.title return entity.title
# For some reason, .webp (stickers' format) is not registered
add_type('image/webp', '.webp')
def get_extension(media): def get_extension(media):
"""Gets the corresponding extension for any Telegram media""" """Gets the corresponding extension for any Telegram media"""