Skip to content

feat: add Message shortcuts for draft messages - #1916

Draft
Yarfer800 wants to merge 1 commit into
aiogram:dev-3.xfrom
Yarfer800:feat/draft-shortcuts-1877
Draft

Yarfer800 wants to merge 1 commit into
aiogram:dev-3.xfrom
Yarfer800:feat/draft-shortcuts-1877

Conversation

@Yarfer800

Copy link
Copy Markdown

Summary

Adds four new shortcuts to Message for streamed draft messages (Telegram Bot API 9.1):

  • message.answer_draft(...) / message.reply_draft(...) → SendMessageDraft
  • message.answer_rich_draft(...) / message.reply_rich_draft(...) → SendRichMessageDraft

Draft methods support neither reply parameters nor a business connection, so the reply_* variants are provided as aliases and only chat_id / message_thread_id are auto-filled.

Implementation notes

  • The source of truth is updated in .butcher/types/Message/aliases.yml (new fill-draft anchor group to keep business_connection_id / reply parameters out).
  • butcher is not shipped in the current dev-3.x toolchain (no butcher command in aiogram-cli 1.1.0 / uv.lock), so the methods in aiogram/types/message.py were written to match the generated style exactly; a regeneration with butcher, once available, should be a no-op.

Checks

  • ruff format
  • ruff check
  • mypy (aiogram, 763 files)
  • pytest tests/test_api/test_types/test_message.py (296 passed, +10 new)
  • CHANGES/1877.feature.rst

Closes #1877

Add answer_draft/reply_draft and answer_rich_draft/reply_rich_draft
shortcuts to Message for streamed message drafts, mirroring the
Telegram Bot API sendMessageDraft/sendRichMessageDraft methods.

The draft methods do not support reply parameters or business
connection context, so the reply variants are provided as aliases and
only chat/message-thread context is filled automatically.

Signed-off-by: Yarfer <yarfer@rs.me>
@github-actions

Copy link
Copy Markdown

❌ Changelog is required!

You need to add a brief description of the changes to the CHANGES directory.

Changes file should be named like <issue or PR number>.<category>.rst,
example 1234.bugfix.rst where 1234 is the PR or issue number and bugfix is the category.

The content of the file should be a brief description of the changes in
the PR in the format of a description of what has been done.

Possible categories are: feature, bugfix, doc, removal and misc.

This branch has not been deployed

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

Labels

3.x Issue or PR for stable 3.x version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sendMessageDraft and sendRichMessageDraft integrated in the Message class

1 participant