send link for videos that are too large

This commit is contained in:
bakatrouble 2023-05-13 04:38:55 +03:00
parent c7c469c8a3
commit 0f4d779e0c

18
main.py
View File

@ -63,13 +63,17 @@ async def check_updates():
file.name = f'file.{post.file.ext}' file.name = f'file.{post.file.ext}'
file.seek(0) file.seek(0)
if post.file.ext == 'webm': if post.file.ext == 'webm':
await bot.send_video(int(os.environ['SEND_CHAT']), if post.file.size < 50_000_000:
file, await bot.send_video(int(os.environ['SEND_CHAT']),
width=post.file.width, file,
height=post.file.height, width=post.file.width,
thumb=post.preview.url, height=post.file.height,
caption=caption, thumb=post.preview.url,
parse_mode=ParseMode.HTML) 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': elif post.file.ext == 'gif':
await bot.send_animation(int(os.environ['SEND_CHAT']), await bot.send_animation(int(os.environ['SEND_CHAT']),
file, file,