Skip to content

feat(send_message): auto-detect @username mentions as Telegram entities - #27865

Closed
fonhal wants to merge 1 commit into
NousResearch:mainfrom
fonhal:feat/send-message-mention-entities
Closed

feat(send_message): auto-detect @username mentions as Telegram entities#27865
fonhal wants to merge 1 commit into
NousResearch:mainfrom
fonhal:feat/send-message-mention-entities

Conversation

@fonhal

@fonhal fonhal commented May 18, 2026

Copy link
Copy Markdown
Contributor

Problem

When bots send messages containing @username to each other via send_message, the @username text doesn't generate a Telegram MessageEntity(type="mention"). This means the receiving bot's require_mention Gateway filter cannot detect the mention, breaking bot-to-bot interop.

Fix

Auto-detect @username patterns in outgoing messages and create MessageEntity(type="mention") entries with correct offset/length, passed as the entities parameter to send_message.

Changes

  • tools/send_message_tool.py: Added regex _MENTION_RE to detect @username patterns (3-32 chars), generates MessageEntity list, passed to both MarkdownV2 and plain-text send paths.

…m entities

When sending messages containing @username patterns, auto-generate
MessageEntity(type='mention') entries so that the receiving bot's
require_mention filter can trigger. This enables proper bot-to-bot
interop where mention-based routing is used.
@alt-glitch alt-glitch added type/feature New feature or request comp/tools Tool registry, model_tools, toolsets platform/telegram Telegram bot adapter P3 Low — cosmetic, nice to have labels May 18, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #28499. Authorship preserved (rebase-merge). #28499

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

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have platform/telegram Telegram bot adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants