Telegram Bot API
🌐 Türkçe

restrictChatMember

Kategori: Yönetim · Bot API 10.3 · Resmi dokümantasyon

Sohbet üyesini kısıtlar.

Dönüş değeri: Başarılı olduğunda True döndürür.

Parametreler

ParametreTürZorunluAçıklama
chat_idInteger or StringEvetSohbet ID'si
user_idIntegerEvetKullanıcı ID'si
permissionsChatPermissionsEvetJSON ChatPermissions nesnesi
use_independent_chat_permissionsBooleanİsteğe bağlıBağımsız izinleri kullan
until_dateIntegerİsteğe bağlıKısıtlama bitiş zaman damgası

Parametre açıklamaları kısa özetlerdir; tam metin için resmi dokümantasyona bakın.

Örnek istek

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/restrictChatMember" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_id": 123456789,
  "user_id": 123456789,
  "permissions": {
    "can_send_messages": true
  }
}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/restrictChatMember",
    json={
        "chat_id": 123456789,
        "user_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}/restrictChatMember`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "user_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