From 0f4d779e0cfbe94e0cf556a533b5184762db4299 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Sat, 13 May 2023 04:38:55 +0300 Subject: [PATCH] send link for videos that are too large --- main.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 9fb49e0..fe222b7 100644 --- a/main.py +++ b/main.py @@ -63,13 +63,17 @@ async def check_updates(): file.name = f'file.{post.file.ext}' file.seek(0) if post.file.ext == 'webm': - await bot.send_video(int(os.environ['SEND_CHAT']), - file, - width=post.file.width, - height=post.file.height, - thumb=post.preview.url, - caption=caption, - parse_mode=ParseMode.HTML) + if post.file.size < 50_000_000: + await bot.send_video(int(os.environ['SEND_CHAT']), + file, + width=post.file.width, + height=post.file.height, + thumb=post.preview.url, + caption=caption, + parse_mode=ParseMode.HTML) + else: + await bot.send_message(int(os.environ['SEND_CHAT']), + f'File is too large: {post.file.url}\n\n' + caption) elif post.file.ext == 'gif': await bot.send_animation(int(os.environ['SEND_CHAT']), file,