setChatPhoto
Sohbet fotoğrafını ayarlar.
Dönüş değeri: Başarılı olduğunda True döndürür.
Parametreler
| Parametre | Tür | Zorunlu | Açıklama |
|---|---|---|---|
chat_id | Integer or String | Evet | Sohbet ID'si |
photo | InputFile | Evet | Yeni sohbet fotoğrafı URL'si veya file_id |
Örnek istek
curl
curl -s "https://api.telegram.org/bot$TOKEN/setChatPhoto" \
-F chat_id=123456789 \
-F photo=@photo.jpg
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/setChatPhoto",
data={
"chat_id": 123456789
},
files={"photo": open("photo.jpg", "rb")},
timeout=30,
)
print(resp.json())
JavaScript
import { readFile } from "node:fs/promises";
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const form = new FormData();
form.append("chat_id", "123456789");
form.append("photo", new Blob([await readFile("photo.jpg")]), "photo.jpg");
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/setChatPhoto`, { method: "POST", body: form });
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
getChatSohbet bilgilerini alır.getChatMemberSohbet üyesi bilgilerini alır.getChatMemberCountSohbet üyesi sayısını döndürür.getChatAdministratorsSohbet yöneticilerinin listesini döndürür.setChatTitleSohbet başlığını ayarlar.setChatDescriptionSohbet açıklamasını ayarlar.deleteChatPhotoSohbet fotoğrafını siler.setChatPermissionsSohbet izinlerini ayarlar.leaveChatSohbetten ayrılır.exportChatInviteLinkSohbetin ana davet bağlantısını oluşturur.createChatInviteLinkDavet bağlantısı oluşturur.editChatInviteLinkDavet bağlantısını düzenler.