mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-24 00:04:14 +03:00
Fix sending byte strings as files not working
This commit is contained in:
parent
b136074340
commit
1eeedc613b
|
@ -323,17 +323,19 @@ def get_input_media(media, user_caption=None, is_photo=False):
|
||||||
|
|
||||||
def is_image(file):
|
def is_image(file):
|
||||||
"""Returns True if the file extension looks like an image file"""
|
"""Returns True if the file extension looks like an image file"""
|
||||||
return (mimetypes.guess_type(file)[0] or '').startswith('image/')
|
return (isinstance(file, str) and
|
||||||
|
(mimetypes.guess_type(file)[0] or '').startswith('image/'))
|
||||||
|
|
||||||
def is_audio(file):
|
def is_audio(file):
|
||||||
"""Returns True if the file extension looks like an audio file"""
|
"""Returns True if the file extension looks like an audio file"""
|
||||||
return (mimetypes.guess_type(file)[0] or '').startswith('audio/')
|
return (isinstance(file, str) and
|
||||||
|
(mimetypes.guess_type(file)[0] or '').startswith('audio/'))
|
||||||
|
|
||||||
|
|
||||||
def is_video(file):
|
def is_video(file):
|
||||||
"""Returns True if the file extension looks like a video file"""
|
"""Returns True if the file extension looks like a video file"""
|
||||||
return (mimetypes.guess_type(file)[0] or '').startswith('video/')
|
return (isinstance(file, str) and
|
||||||
|
(mimetypes.guess_type(file)[0] or '').startswith('video/'))
|
||||||
|
|
||||||
|
|
||||||
def parse_phone(phone):
|
def parse_phone(phone):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user