diff --git a/stdplugins/kbass_file_to_photo.py b/stdplugins/kbass_file_to_photo.py index e999e92..f267cab 100644 --- a/stdplugins/kbass_file_to_photo.py +++ b/stdplugins/kbass_file_to_photo.py @@ -14,8 +14,12 @@ async def on_file_to_photo(event, target): image = target.media.document except AttributeError: return - if image.mime_type == 'image/webp' or not image.mime_type.startswith('image/'): - return + if not image.mime_type.startswith('image/'): + return # This isn't an image + if image.mime_type == 'image/webp': + return # Telegram doesn't let you directly send stickers as photos + if image.size > 10 * 1024 * 1024: + return # We'd get PhotoSaveFileInvalidError otherwise file = await borg.download_media(target, file=BytesIO()) file.seek(0)