mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-03-06 14:03:07 +00:00
fix: prevent 'caption is too long' error in logo mode
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.
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user