setMyProfilePhoto
Mengatur foto profil bot.
Nilai kembalian: Jika berhasil, mengembalikan True.
Parameter
| Parameter | Tipe | Wajib | Deskripsi |
|---|---|---|---|
photo | InputProfilePhoto | Ya | URL atau file_id foto profil |
Contoh permintaan
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/setMyProfilePhoto" \
-H "Content-Type: application/json" \
-d '{"photo":{"type":"static","photo":"attach://photo"}}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/setMyProfilePhoto",
json={
"photo": {
"type": "static",
"photo": "attach://photo"
}
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/setMyProfilePhoto`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"photo": {
"type": "static",
"photo": "attach://photo"
}
}),
});
console.log(await res.json());
Panduan langkah demi langkah: Cara Membuat Bot Telegram: dari BotFather sampai Pesan Pertama
Metode terkait
getMeMengembalikan informasi bot.getMyCommandsMengembalikan daftar perintah bot saat ini.setMyCommandsMengatur daftar perintah bot.deleteMyCommandsMenghapus perintah bot.getMyNameMengembalikan nama bot.setMyNameMengatur nama bot.getMyDescriptionMengembalikan deskripsi bot.setMyDescriptionMengatur deskripsi bot.getMyShortDescriptionMengembalikan deskripsi singkat bot.setMyShortDescriptionMengatur deskripsi singkat bot.removeMyProfilePhotoMenghapus foto profil bot.getUserProfilePhotosMengembalikan foto profil pengguna.