StaticGramBot API

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

Gifts a Telegram Premium subscription to the given user. Returns True on success.

Параметры

user_idIntegerобязательный
Unique identifier of the target user who will receive a Telegram Premium subscription
month_countIntegerобязательный
Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12
star_countIntegerобязательный
Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months
textStringнеобязательный
Text that will be shown along with the service message about the subscription; 0-128 characters
text_parse_modeStringнеобязательный
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.
text_entitiesArray of MessageEntityнеобязательный
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/giftPremiumSubscription" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 123456789,
    "month_count": 1,
    "star_count": 50
  }'
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.gift_premium_subscription(user_id=123456789, month_count=1, star_count=50)
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/giftPremiumSubscription`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "user_id": 123456789,
    "month_count": 1,
    "star_count": 50
  }),
});
const data = await res.json();

Ответ (True)

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

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