From 16da3634db93b56413ccc68caff5356c838edc50 Mon Sep 17 00:00:00 2001 From: er8dd Date: Fri, 22 Mar 2024 04:13:32 +0400 Subject: [PATCH] telegram anti-flood --- server/custom.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/custom.py b/server/custom.py index c3db8e3..cf94fbe 100644 --- a/server/custom.py +++ b/server/custom.py @@ -205,6 +205,8 @@ async def handle_user_message(message: types.Message, super_chat_id: int, bot): await send_to_superchat(is_super_group, message, super_chat_id, bot) except (exceptions.Unauthorized, exceptions.ChatNotFound): return SendMessage(chat_id=message.chat.id, text=_("Не удаётся связаться с владельцем бота")) + except exceptions.RetryAfter: + return SendMessage(chat_id=message.chat.id, text=_("Слишком много сообщений, подождите одну минуту")) except exceptions.TelegramAPIError as err: _logger.error(f"(exception on forwarding) {err}") return