fix: emoji reactions rejected on U+FE0F, and caption editing for media messages - #71
Merged
Merged
Conversation
… chats
Telegram's active emoji reactions are stored without the U+FE0F variation
selector (the heart is U+2764, not U+2764 U+FE0F). Sending the FE0F form made
addMessageReaction fail with REACTION_INVALID ("The reaction isn't available
for the message") - this hit reactions like the heart while single-codepoint
emojis worked. Strip the variation selector before reacting.
Also inspect the chat's available_reactions: when a chat restricts its
reaction set (many channels do), return a clear, non-error message listing the
allowed reactions instead of surfacing the raw TDLib exception, and degrade
gracefully if the request still fails - so the model doesn't treat reactions
as globally broken.
editMessageText only works on text messages; TDLib rejects it for a message whose content is a photo/video/etc., so editing a sent photo's caption failed. Inspect the message content type and use editMessageCaption for media messages, keeping editMessageText for plain text.
Alex2772
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent bug fixes in tools, both found while running the bot against real Telegram chats.
1.
react_with_emoji: reactions failing withREACTION_INVALIDSetting a reaction failed with TDLib error
REACTION_INVALID("The reaction isn't available for the message") for some emoji, seemingly at random.Root cause: Telegram stores active emoji reactions without the variation selector U+FE0F. The heart is
❤(U+2764), not❤️(U+2764 U+FE0F). The model tends to emit the U+FE0F form, andaddMessageReactionrejects it.Confirmed from logs: only
❤️and⚡️ever failed, while every single-codepoint emoji (🔥 ×165, 🤔 ×188, 🥰, 👍, 🤣, 😁, 🌚, 👌, 👀, 💔) went through fine.Fix:
stripVariationSelector()removes the U+FE0F bytes before the emoji is passed toaddMessageReaction.The commit also adds two smaller robustness improvements:
chat->available_reactions_— when it ischatAvailableReactionsSome, verify membership and return a meaningful answer listing the allowed reactions instead of failing opaquely;Note: the availability check alone does not fix the bug — in a private chat the set is
All, so the call reachesaddMessageReactionand still fails on U+FE0F. Stripping the selector is the actual fix.2.
edit_message_text: cannot edit captions of photo/video messagesThe tool always called
editMessageText, which TDLib rejects for media messages, so the bot could never edit a caption of a photo it had sent.Fix: branch on
message->content_->get_id()— text messages go toeditMessageText, media with a caption (photo/video) goes toeditMessageCaption.Both fixes have been running in production in my fork for several days. Branch is rebased onto current
master.