setChatPermissions
Sohbet izinlerini 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 |
permissions | ChatPermissions | Evet | JSON ChatPermissions nesnesi |
use_independent_chat_permissions | Boolean | İsteğe bağlı | Bağımsız izinleri kullan |
Örnek istek
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/setChatPermissions" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"permissions":{"can_send_messages":true}}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/setChatPermissions",
json={
"chat_id": 123456789,
"permissions": {
"can_send_messages": True
}
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/setChatPermissions`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"permissions": {
"can_send_messages": true
}
}),
});
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.setChatPhotoSohbet fotoğrafını ayarlar.deleteChatPhotoSohbet fotoğrafını siler.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.