From c548bc09e65add6888c7c4be497659fad6e8ed1a Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Wed, 22 Mar 2023 19:25:06 +0300 Subject: [PATCH] workaround --- main.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 58df2ed..fd19daf 100644 --- a/main.py +++ b/main.py @@ -37,18 +37,19 @@ async def check_updates(): f'Artist: {" ".join(post.tags.artist)}\n' \ f'Character: {" ".join(post.tags.character)}\n\n' \ f'https://e621.net/posts/{post.id}' - if post.file.ext == 'webm': - await bot.send_video(int(os.environ['SEND_CHAT']), - post.file.url, - width=post.file.width, - height=post.file.height, - thumb=post.preview.url, - caption=caption) - else: - await bot.send_photo(int(os.environ['SEND_CHAT']), - post.file.url, - caption=caption) - await redis.sadd('e621:sent', post.id) + if post.file.url: + if post.file.ext == 'webm': + await bot.send_video(int(os.environ['SEND_CHAT']), + post.file.url, + width=post.file.width, + height=post.file.height, + thumb=post.preview.url, + caption=caption) + else: + await bot.send_photo(int(os.environ['SEND_CHAT']), + post.file.url, + caption=caption) + await redis.sadd('e621:sent', post.id) @dp.message_handler(commands=['add'])