sendRichMessageDraft

Returns: bool

class aiogram.methods.send_rich_message_draft.SendRichMessageDraft(*, chat_id: int, draft_id: int, rich_message: InputRichMessage, message_thread_id: int | None = None, can_stop: bool | None = None, keep_on_stop: bool | None = None, **extra_data: Any)[source]

Use this method to stream a partial rich message to a user while the message is being generated. Note that the streamed draft is ephemeral and acts as a temporary 30-second preview - once the output is finalized, you must call aiogram.methods.send_rich_message.SendRichMessage with the complete message to persist it in the user’s chat. Returns True on success.

Source: https://core.telegram.org/bots/api#sendrichmessagedraft

chat_id: int

Unique identifier for the target private chat

draft_id: int

Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated. Otherwise, the draft is replaced without animation

rich_message: InputRichMessage

The partial message to be streamed. Direct upload of new files and explicit upload of files by a URL isn’t supported

message_thread_id: int | None

Unique identifier for the target message thread

can_stop: bool | None

Pass True to show the user a button to stop further drafts. The bot will receive an aiogram.types.update.Update „stopped_message_generation“ if the user presses the button

keep_on_stop: bool | None

Pass True to keep the draft in the chat when the button is pressed. The draft will still disappear after a short time or if the bot sends a message. To fully preserve the partial draft, the bot should send it as a new message

Usage

As bot method

result: bool = await bot.send_rich_message_draft(...)

Method as object

Imports:

  • from aiogram.methods.send_rich_message_draft import SendRichMessageDraft

  • alias: from aiogram.methods import SendRichMessageDraft

With specific bot

result: bool = await bot(SendRichMessageDraft(...))

As reply into Webhook in handler

return SendRichMessageDraft(...)