log send exception
This commit is contained in:
parent
c30cf4b950
commit
547132d5d6
5
main.py
5
main.py
@ -5,7 +5,7 @@ import os
|
|||||||
import redis.asyncio as aioredis
|
import redis.asyncio as aioredis
|
||||||
from aiogram import Bot, Dispatcher
|
from aiogram import Bot, Dispatcher
|
||||||
from aiogram.types import Message
|
from aiogram.types import Message
|
||||||
from aiogram.utils import executor
|
from aiogram.utils import executor, exceptions
|
||||||
import dotenv
|
import dotenv
|
||||||
|
|
||||||
from e621 import E621
|
from e621 import E621
|
||||||
@ -38,6 +38,7 @@ async def check_updates():
|
|||||||
f'Character: {" ".join(post.tags.character)}\n\n' \
|
f'Character: {" ".join(post.tags.character)}\n\n' \
|
||||||
f'https://e621.net/posts/{post.id}'
|
f'https://e621.net/posts/{post.id}'
|
||||||
if post.file.url:
|
if post.file.url:
|
||||||
|
try:
|
||||||
logging.warning(post.file.url)
|
logging.warning(post.file.url)
|
||||||
if post.file.ext == 'webm':
|
if post.file.ext == 'webm':
|
||||||
await bot.send_video(int(os.environ['SEND_CHAT']),
|
await bot.send_video(int(os.environ['SEND_CHAT']),
|
||||||
@ -51,6 +52,8 @@ async def check_updates():
|
|||||||
post.file.url,
|
post.file.url,
|
||||||
caption=caption)
|
caption=caption)
|
||||||
await redis.sadd('e621:sent', post.id)
|
await redis.sadd('e621:sent', post.id)
|
||||||
|
except exceptions.TelegramAPIError as e:
|
||||||
|
logging.exception(e)
|
||||||
|
|
||||||
|
|
||||||
@dp.message_handler(commands=['add'])
|
@dp.message_handler(commands=['add'])
|
||||||
|
Loading…
Reference in New Issue
Block a user