feat(reactions): support custom emoji reactions - #163
Open
errogaht wants to merge 2 commits into
Open
Conversation
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.
Problem
get_message_reactionsalready exposes custom reactions ascustom:<document_id>, butsend_reactionalways constructsReactionEmoji. Passing the value returned by the read API back into the writeAPI therefore cannot reproduce the custom reaction.
This breaks an otherwise useful read-modify-write flow for MCP clients: they can
identify a Telegram custom reaction, but cannot send the same reaction.
Change
custom:<positive document id>insend_reaction.ReactionCustomEmojifor that representation.add_to_recent=True, matching the behavior expected when a customreaction is selected from Telegram's reaction picker.
REACTION_INVALID, retry the same custom reaction once without the flag.This handles private-chat behavior without hiding errors for normal Unicode
reactions.
request.
The input representation intentionally matches the existing
get_message_reactionsoutput, so custom reactions now round-trip without anew tool field or breaking schema change.
Validation
uv run pytest tests/test_reactions.py -q— 7 passed.uv run pytest— 170 passed.uv run black --check telegram_mcp/tools/messages.py tests/test_reactions.pyuv run flake8 telegram_mcp/tools/messages.py tests/test_reactions.py --count --select=E9,F63,F7,F82 --show-source --statisticsgit diff --checkThe regression coverage includes:
custom:<document_id>conversion;add_to_recent;