Skip to content

feat(telegram): forwardMessage/forwardMessages/copyMessage/copyMessages support #78724

Description

@andrexibiza

What the API specifies

core.telegram.org/bots/api#forwardmessage: "Use this method to forward messages of any kind... Returns the sent Message". forwardMessages: "forward multiple messages of any kind... Returns an Array of MessageId". copyMessage: "The method is analogous to forwardMessage, but the copied message doesn't have a link to the original message". copyMessages: "copy messages of any kind... Array of MessageId".

What Hermes does today

Repo evidence at current main (3fa318a50c, plugins/platforms/telegram/adapter.py):

  • grep 'forward_message|forwardMessage|copy_message|copyMessage' in adapter.py and tools/send_message_tool.py0 matches (verified at main).

  • adapter.py:4432-4758send() is the only outbound text path; no forwarding/copying entry point anywhere (also checked hermes_cli/telegram_managed_bot.py).

  • adapter.py:5217-5241 — the only deletion-adjacent surface is delete_message; no forward/copy counterpart.

  • Inbound direction only: adapter.py:9633-9800 _build_message_event consumes forward_origin/reply_to_message (extraction PR fix(telegram): extract forwarded message text from caption and forward_origin.api_kwargs #72035 open); nothing ever issues an outbound forward/copy.

Delta

The bot cannot forward or copy an existing message (single or batch) to another chat/topic. Batch params (message_ids 1-100 strictly increasing, video_start_timestamp, show_caption_above_media on copy) are likewise absent.

Why it matters

Relay/mirror workflows (channel mirrors, message routing between groups) must re-send content from scratch instead of using the documented forward/copy API; forwarded messages lose their origin link and quote semantics. The gateway's mirror/relay features re-send content rather than using Bot API forward/copy.

Suggested fix class

Adapter: add forward_message(chat_id, from_chat_id, message_id, ...) and copy_message(...) methods (+ batch variants) to the outbound surface, plus a tools/ entry point or mirror-mode integration.

Interlocks

#43397 (open — preserve forwarded-message metadata inbound; related, not covering), #76615 (open — forwarded channel media dropped inbound; related), #72035 (open PR — inbound forward text extraction; related). None covers outbound forward/copy.

Verification

  1. Call the new adapter method with a real from_chat_id+message_id; assert forwardMessage invoked and Message returned.

  2. Batch path: assert forwardMessages payload with strictly increasing message_ids.

  3. Test copy with show_caption_above_media=True.

Interlock (master meta-lock, 5x2x3 validated)

Related #28614 #43397 #43477 #51543 #51747 #52126 #54262 #72035 #76615 #79066 #79067 #79068 #79069 #79070

Related #28614 #43397 #43477 #51543 #51747 #52126 #54262 #72035 #76615 #79066 #79067 #79068 #79069 #79070 #79392 #79393 #79394 #79395 #79396

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/pluginsPlugin system and bundled pluginsplatform/telegramTelegram bot adaptertype/featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions