Guruh boshqaruvi
setChatDescription
Guruh yoki kanal tavsifini o'zgartiradi yoki tozalaydi.
POST
https://api.zamin.app/bot<TOKEN>/setChatDescriptionGET ham ishlaydi. Parametrlar: query, JSON, form yoki multipart — batafsil.
Botda can_change_info huquqi kerak. description berilmasa yoki bo'sh bo'lsa, tavsif tozalanadi. Xizmat xabari chiqmaydi.
Parametrlar
| Parametr | Turi | Majburiy | Cheklov | Izoh |
|---|---|---|---|---|
chat_id | Integer yoki String | Majburiy | manfiy id yoki @username | Bot a'zo bo'lgan guruh yoki kanal: manfiy id (message.chat.id) yoki ochiq chatning @username'i. Shaxsiy chat id'si — chat not found. |
description | String | Ixtiyoriy | 0–255 belgi | Berilmasa — tozalanadi. |
Javob
Natija (result): true
JSON
{"ok": true, "result": true}Xatolar
| Kod | Tavsif | Sabab va yechim |
|---|---|---|
| 400 | Bad Request: chat not found | Bunday chat yo'q, bot unda a'zo emas yoki bu shaxsiy chat id'si. Hammasi uchun javob bir xil (atayin). |
| 400 | Bad Request: not enough rights to change chat description | Botda can_change_info yo'q. |
| 400 | Bad Request: description: … | 255 belgidan uzun. |
| 400 | Bad Request: method is not available for this chat | Kanal izohlari chatida (supergroup) bu amal yo'q: bot izoh yoza olmaydi, izohlar chatini boshqarmaydi. |
Istalgan metodda bo'lishi mumkin: 401 Unauthorized, 403 Forbidden: bot is suspended, 429 Too Many Requests, 400 Bad Request: <maydon>: … — xato kodlari.
Misol
Python
import os
import requests
TOKEN = os.environ["ZAMIN_BOT_TOKEN"]
API = f"https://api.zamin.app/bot{TOKEN}"
GROUP_ID = int(os.environ["ZAMIN_GROUP_ID"])
r = requests.post(
f"{API}/setChatDescription",
json={"chat_id": GROUP_ID, "description": "Qoidalar: /rules. Reklama taqiqlangan."},
timeout=15,
)
print(r.json())curl
curl -s -X POST "https://api.zamin.app/bot$ZAMIN_BOT_TOKEN/setChatDescription" \
-H "Content-Type: application/json" \
-d '{
"chat_id": -4012345678,
"description": "Qoidalar: /rules. Reklama taqiqlangan."
}'