mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
A long tweet text or a pixiv artwork with many tags can exceed Telegram's 1024-char caption cap for HTML parse mode, turning an otherwise fine send into a permanent 400. truncate_caption() cuts at a char boundary (never splitting a multi-byte rune or an HTML entity like &) and appends an ellipsis. Applied in caption_with / caption_from_fields, the link-cache re-send path and the inline-query captions.