sendGiftПоддерживается
Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.
Особенности StaticGram
paid from the bot Stars balance through the star gift purchase aggregate; users and channels
Параметры
Required if chat_id is not specified. Unique identifier of the target user who will receive the gift.
Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format
@username) that will receive the gift.Identifier of the gift; limited gifts can't be sent to channel chats
Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
Text that will be shown along with the gift; 0-128 characters
Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, “custom_emoji”, and “date_time” are ignored.
A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, “custom_emoji”, and “date_time” are ignored.
Пример запроса
curl
curl "https://api.staticgram.top/bot$TOKEN/sendGift" \
-H "Content-Type: application/json" \
-d '{
"gift_id": "<gift_id>"
}'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_gift(gift_id="<gift_id>")JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/sendGift`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"gift_id": "<gift_id>"
}),
});
const data = await res.json();Ответ (True)
JSON
{
"ok": true,
"result": true
}