StaticGramBot API

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

Returns the gifts owned by a chat. Returns OwnedGifts on success.

Особенности StaticGram

unsaved gifts only when the bot is an admin; sort_by_price sorts within a page

Параметры

chat_idInteger or Stringобязательный
Unique identifier for the target chat or username of the target channel in the format @username
exclude_unsavedBooleanнеобязательный
Pass True to exclude gifts that aren't saved to the chat's profile page. Always True, unless the bot has the can_post_messages administrator right in the channel.
exclude_savedBooleanнеобязательный
Pass True to exclude gifts that are saved to the chat's profile page. Always False, unless the bot has the can_post_messages administrator right in the channel.
exclude_unlimitedBooleanнеобязательный
Pass True to exclude gifts that can be purchased an unlimited number of times
exclude_limited_upgradableBooleanнеобязательный
Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
exclude_limited_non_upgradableBooleanнеобязательный
Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
exclude_from_blockchainBooleanнеобязательный
Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
exclude_uniqueBooleanнеобязательный
Pass True to exclude unique gifts
sort_by_priceBooleanнеобязательный
Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
offsetStringнеобязательный
Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
limitIntegerнеобязательный
The maximum number of gifts to be returned; 1-100. Defaults to 100.

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

curl
curl "https://api.staticgram.top/bot$TOKEN/getChatGifts" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": 123456789
  }'
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.get_chat_gifts(chat_id=123456789)
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/getChatGifts`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789
  }),
});
const data = await res.json();

Ответ (OwnedGifts)

JSON
{
  "ok": true,
  "result": {
    "total_count": 1,
    "gifts": []
  }
}

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