StaticGramBot API

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.

Поддерживается частично

rich content validated, delivered as a plain-text draft

Параметры

chat_idIntegerобязательный
Unique identifier for the target private chat
message_thread_idIntegerнеобязательный
Unique identifier for the target message thread
draft_idIntegerобязательный
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_messageInputRichMessageобязательный
The partial message to be streamed. Direct upload of new files and explicit upload of files by a URL isn't supported.
can_stopBooleanнеобязательный
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_stopBooleanнеобязательный
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.

Пример запроса

curl
curl "https://api.staticgram.top/bot$TOKEN/sendRichMessageDraft" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": 123456789,
    "draft_id": 1,
    "rich_message": {}
  }'
aiogram 3
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer

session = AiohttpSession(api=TelegramAPIServer.from_base("https://api.staticgram.top"))
bot = Bot(TOKEN, session=session)

result = await bot.send_rich_message_draft(chat_id=123456789, draft_id=1, rich_message={})
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/sendRichMessageDraft`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "draft_id": 1,
    "rich_message": {}
  }),
});
const data = await res.json();

Ответ (True)

JSON
{
  "ok": true,
  "result": true
}

Описания методов и типов взяты из официальной документации Telegram Bot API (Bot API 10.3). Адрес API: https://api.staticgram.top