fix(telegram): split long messages to avoid Message is too long error

Telegram has a 4096 character limit per message. This fix:
- Splits messages longer than 4000 chars into multiple chunks
- Prefers breaking at newline boundaries to preserve formatting
- Falls back to space boundaries if no newlines available
- Forces split at max length if no good boundaries exist
- Adds comprehensive tests for message splitting logic
This commit is contained in:
zhouzhuojie
2026-02-15 22:39:31 +00:00
parent a5265c263d
commit 203aa154d4
3 changed files with 459 additions and 16 deletions

2
.gitignore vendored
View File

@@ -19,4 +19,4 @@ __pycache__/
poetry.lock
.pytest_cache/
botpy.log
tests/