StaticGramBot API

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

Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

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

multipart upload (or an existing photo file_id of this server); emits new_chat_photo

Параметры

chat_idInteger or Stringобязательный
Unique identifier for the target chat or username of the target channel in the format @username
photoInputFileобязательный
New chat photo, uploaded using multipart/form-data

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

curl
curl "https://api.staticgram.top/bot$TOKEN/setChatPhoto" \
  -F 'chat_id=123456789' \
  -F "photo=@photo.jpg"
aiogram 3
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer
from aiogram.types import FSInputFile

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

result = await bot.set_chat_photo(chat_id=123456789, photo=FSInputFile("photo.jpg"))
JavaScript
const form = new FormData();
form.append("chat_id", "123456789");
form.append("photo", fileBlob, "photo.jpg");

const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/setChatPhoto`, {
  method: "POST",
  body: form,
});
const data = await res.json();

Ответ (True)

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

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