forked from actuallyrizzn/broca-2
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Problem
The TelegramBot plugin does not handle messages that exceed Telegram's maximum message length limit (4,096 characters). When a response message exceeds this limit, it fails to send or gets truncated, resulting in incomplete message delivery.
Current Behavior
When a response message exceeds 4,096 characters:
- The message is sent directly via
bot.send_message()without length checking - Telegram API rejects or truncates the message
- Users receive incomplete responses or no response at all
Expected Behavior
The plugin should:
- Check if the message length exceeds 4,096 characters
- Split the message into multiple messages if it exceeds the limit
- Send all message parts sequentially to ensure complete delivery
- Maintain message context/continuity (e.g., "Part 1/3", "Part 2/3", etc.) if desired
Affected Code Locations
plugins/telegram_bot/plugin.pyline 389:_handle_response()methodplugins/telegram_bot/message_handler.pyline 174:send_response()method
Technical Details
- Telegram Bot API maximum message length: 4,096 characters
- Current implementation sends messages without length validation
- No message splitting logic exists
Suggested Solution
Implement a message splitting utility that:
- Splits messages at word boundaries when possible (to avoid breaking words)
- Falls back to character-level splitting if needed
- Sends multiple messages sequentially
- Optionally adds part indicators (e.g., "[1/3]", "[2/3]", "[3/3]")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels