StaticGramBot API

setManagedBotAccessSettingsЧастично

Use this method to change the access settings of a managed bot. Returns True on success.

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

stored and returned; not enforced on incoming messages yet

Параметры

user_idIntegerобязательный
User identifier of the managed bot whose access settings will be changed
is_access_restrictedBooleanобязательный
Pass True if only selected users can access the bot. The bot's owner can always access it.
added_user_idsArray of Integerнеобязательный
A JSON-serialized list of up to 10 identifiers of users who will have access to the bot in addition to its owner. Ignored if is_access_restricted is False.

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

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

Ответ (True)

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

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