feat(telegram): add plugin-owned callback actions - #65255
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused post-built-in callback design and for covering both live and standalone delivery paths.
Problems
tools/send_message_tool.py:1353attaches markup only when the media item is the final input entry. If that entry is missing or fails after an earlier media send succeeds, delivery succeeds without any keyboard.cron/jobs.py:1053accepts built-in callback prefixes. Telegram claimsmp:,gt:,ea:,sc:,cl:, andupdate_prompt:before the new hook (plugins/platforms/telegram/adapter.py:5637-5945on current main), so those buttons are not plugin-owned.--buttonhas no supported clear operation despitecron editadvertising replacement; an empty button list is invalid.- The public hook reference still says only two hook return values affect behavior (
website/docs/user-guide/features/hooks.md:374).
Suggested changes
- Deliver markup on the final successful message/media and test missing-final-media behavior.
- Reserve or reject built-in callback namespaces, add a clear-buttons path, and document the new hook contract.
Automated hermes-sweeper review.
| media_kwargs["caption"] = _tg_caption | ||
| media_kwargs["parse_mode"] = send_parse_mode | ||
| if ( | ||
| reply_markup is not None |
There was a problem hiding this comment.
This selects the final input attachment rather than the final successfully delivered attachment. If this final file is absent (or its send fails) after an earlier media send succeeds, the method returns success but no message has reply_markup. Attach the keyboard to the final successful send and cover that fallback.
| label, callback_data = (part.strip() for part in raw.split("=", 1)) | ||
| if not label or len(label) > 64: | ||
| raise ValueError("button labels must contain 1 to 64 characters") | ||
| if not callback_data or len(callback_data.encode("utf-8")) > 64: |
There was a problem hiding this comment.
Please reject or reserve Telegram's built-in callback namespaces here. Values such as ea:, sc:, cl:, gt:, mp:, and update_prompt: are consumed before the post-built-in plugin hook, contradicting the CLI contract that this callback data is handled by platform_callback.
|
Thanks — this overlaps a generic callback/delivery surface I was preparing for an external plugin, so I’m avoiding a competing PR while this and #59159 are open. A concrete external-plugin consumer needs the following combination:
Does the proposed cron button syntax remain attached when the result is primarily a I’m happy to adapt the external consumer to whichever single API maintainers prefer; the goal is to converge rather than add another overlapping callback hook. |
Summary
Safety
Verification