From 098b5201382dfc6cf4883ef44a7b2cf8b6a97eff Mon Sep 17 00:00:00 2001 From: Redume Date: Sun, 8 Dec 2024 14:04:25 +0300 Subject: [PATCH] feat: Made an exception if no channel is found. And if there is no channel in the database --- events/reactions.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/events/reactions.py b/events/reactions.py index a9916df..258df9a 100644 --- a/events/reactions.py +++ b/events/reactions.py @@ -1,4 +1,5 @@ from aiogram import types, Router +from aiogram.exceptions import TelegramBadRequest from bot import bot from database.database import pg_con @@ -57,5 +58,8 @@ async def register_message_reaction(event: types.MessageReactionUpdated): event.chat.id ) - if reaction_count_message[0] >= reaction_count_chat[0]: - await bot.copy_message(message_id=event.message_id, from_chat_id=event.chat.id, chat_id=reaction_count_chat[1]) + try: + if reaction_count_message[0] >= reaction_count_chat[0] and reaction_count_chat[1] is not None: + await bot.copy_message(message_id=event.message_id, from_chat_id=event.chat.id, chat_id=reaction_count_chat[1]) + except TelegramBadRequest: + return \ No newline at end of file