setMyCommandsПоддерживается
Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success.
Особенности StaticGram
all BotCommandScope types + language_code; default/no-language bucket = MTProto botInfo.commands, others in bot_api_bot_settings (0254)
Параметры
A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands.
Пример запроса
curl
curl "https://api.staticgram.top/bot$TOKEN/setMyCommands" \
-H "Content-Type: application/json" \
-d '{
"commands": [
{
"command": "start",
"description": "Запуск"
}
]
}'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_my_commands(commands=[{"command": "start", "description": "Запуск"}])JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/setMyCommands`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"commands": [
{
"command": "start",
"description": "Запуск"
}
]
}),
});
const data = await res.json();Ответ (True)
JSON
{
"ok": true,
"result": true
}