From 6e28a1a22b02055b357051dfecbee7fefbebc774 Mon Sep 17 00:00:00 2001 From: Fringg Date: Wed, 18 Feb 2026 18:26:26 +0300 Subject: [PATCH] fix: prevent 'caption is too long' error in logo mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Telegram limits photo captions to 1024 characters. When menu_text or rules_text exceeds 900 chars (with promo hints, random messages etc), bot.send_photo fails with TelegramBadRequest. Added len() check before each of 3 send_photo calls in required_sub_channel_check — falls back to send_message when text is too long, consistent with _answer_with_photo in message_patch.py. --- app/handlers/start.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/handlers/start.py b/app/handlers/start.py index 0624e1e0..cb05ca60 100644 --- a/app/handlers/start.py +++ b/app/handlers/start.py @@ -1989,7 +1989,7 @@ async def required_sub_channel_check( custom_buttons=custom_buttons, ) - if settings.ENABLE_LOGO_MODE: + if settings.ENABLE_LOGO_MODE and len(menu_text) <= 900: _result = await bot.send_photo( chat_id=query.from_user.id, photo=get_logo_media(), @@ -2082,7 +2082,7 @@ async def required_sub_channel_check( custom_buttons=custom_buttons, ) - if settings.ENABLE_LOGO_MODE: + if settings.ENABLE_LOGO_MODE and len(menu_text) <= 900: _result = await bot.send_photo( chat_id=query.from_user.id, photo=get_logo_media(), @@ -2112,7 +2112,7 @@ async def required_sub_channel_check( else: rules_text = await get_rules(language) - if settings.ENABLE_LOGO_MODE: + if settings.ENABLE_LOGO_MODE and len(rules_text) <= 900: _result = await bot.send_photo( chat_id=query.from_user.id, photo=get_logo_media(),