StaticGramBot API

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

Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success.

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

PNG/JPEG/WEBP → WEBP (lossless, internal/webpenc), longest side 512; TGS gzip check; WEBM magic check (dimensions not probed)

Параметры

user_idIntegerобязательный
User identifier of sticker file owner
stickerInputFileобязательный
A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. More information on Sending Files »
sticker_formatStringобязательный
Format of the sticker, must be one of “static”, “animated”, “video”

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

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

Ответ (File)

JSON
{
  "ok": true,
  "result": {
    "file_id": "...",
    "file_unique_id": "..."
  }
}

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