Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling the maximum length of a Telegram message #1616

Merged
merged 3 commits into from
Mar 7, 2022
Merged

Handling the maximum length of a Telegram message #1616

merged 3 commits into from
Mar 7, 2022

Conversation

evgeek
Copy link
Contributor

@evgeek evgeek commented Nov 26, 2021

The maximum allowed length of a Telegram message - 4096 symbols ('text' field).
Longer messages are not delivered.

Therefore, I implemented truncating too long message to the maximum length allowed as the default behavior.
An additional option that you can enable by splitLongMessages is splitting too long message into several. Also, using delayBetweenMessages you can enable a 1 second delay between sending a split message to avoid the 429 Too Many Requests error (according to the recommendations - My bot is hitting limits, how do I avoid this?)

The maximum allowed length of a Telegram message - 4096 symbols (https://core.telegram.org/bots/api#message, 'text' field). 
Longer messages are not delivered.
Therefore, I implemented splitting too long message into several (with a 1 second delay between sending according to the documentation - https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this) as the default behavior. 
An additional option that you can enable by truncateLongMessage is to leave one message, but truncate it to the maximum length allowed.
@Seldaek Seldaek merged commit 832660e into Seldaek:main Mar 7, 2022
@Seldaek
Copy link
Owner

Seldaek commented Mar 7, 2022

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants