sendRichMessageDraft()
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 sendRichMessage with the complete message to persist it in the user's chat. Returns True on success.
parameters
| parameter | type | required | description |
|---|---|---|---|
chat_id | number | required | Unique identifier for the target private chat |
message_thread_id | number | optional | Unique identifier for the target message thread |
draft_id | number | required | 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 | required | The partial message to be streamed. Direct upload of new files and explicit upload of files by a URL isn't supported. |
can_stop | boolean | optional | Pass True to show the user a button to stop further drafts. The bot will receive an Update “stopped_message_generation” if the user presses the button. |
keep_on_stop | boolean | optional | 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. |
returns
boolean
usage in yaebal
sendRichMessageDraft is directly typed on Api — call it straight off bot.api.
import type { SendRichMessageDraftParams } from "@yaebal/types";
await bot.api.sendRichMessageDraft({
chat_id: 123456789,
draft_id: 1,
rich_message: {} /* InputRichMessage */,
} satisfies SendRichMessageDraftParams);context shortcut
also available as ctx.sendRichMessageDraft() on
17
context types — see @yaebal/contexts.
/** 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 [sendRichMessage](https://core.telegram.org/bots/api/#sendrichmessage) with the complete message to persist it in the user's chat. Returns *True* on success. */
ctx.sendRichMessageDraft(params: Omit<SendRichMessageDraftParams, "chat_id" | "message_thread_id">)official Bot API docs: https://core.telegram.org/bots/api/#sendrichmessagedraft