setMyCommands
Botun komut listesini ayarlar.
Dönüş değeri: Başarılı olduğunda True döndürür.
Parametreler
| Parametre | Tür | Zorunlu | Açıklama |
|---|---|---|---|
commands | Array of BotCommand | Evet | JSON BotCommand dizisi [{"command":"start","description":"Begin"}] |
scope | BotCommandScope | İsteğe bağlı | JSON BotCommandScope nesnesi |
language_code | String | İsteğe bağlı | Dil kodu |
Örnek istek
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/setMyCommands" \
-H "Content-Type: application/json" \
-d '{"commands":[{"command":"start","description":"Start the bot"}]}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/setMyCommands",
json={
"commands": [
{
"command": "start",
"description": "Start the bot"
}
]
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/setMyCommands`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"commands": [
{
"command": "start",
"description": "Start the bot"
}
]
}),
});
console.log(await res.json());
Adım adım rehber: Telegram bot nasıl yapılır? BotFather ile adım adım bot oluşturma
İlgili metotlar
getMeBot bilgilerini döndürür.getMyCommandsBotun mevcut komut listesini döndürür.deleteMyCommandsBot komutlarını siler.getMyNameBotun adını döndürür.setMyNameBotun adını ayarlar.getMyDescriptionBotun açıklamasını döndürür.setMyDescriptionBotun açıklamasını ayarlar.getMyShortDescriptionBotun kısa açıklamasını döndürür.setMyShortDescriptionBotun kısa açıklamasını ayarlar.setMyProfilePhotoBotun profil fotoğrafını ayarlar.removeMyProfilePhotoBotun profil fotoğrafını kaldırır.getUserProfilePhotosKullanıcının profil fotoğraflarını döndürür.