Guruh boshqaruvi
setChatTitle
Guruh yoki kanal nomini o'zgartiradi.
POST
https://api.zamin.app/bot<TOKEN>/setChatTitleGET ham ishlaydi. Parametrlar: query, JSON, form yoki multipart — batafsil.
Botda can_change_info huquqi kerak (bot admin bo'lishi shart). Guruhda "nom o'zgardi" xizmat xabari chiqadi va guruhdagi botlar new_chat_title oladi.
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. |
title | String | Majburiy | 1–128 belgi | Bosh va oxiridagi bo'shliqlar olib tashlanadi. |
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 title | Botda can_change_info yo'q. |
| 400 | Bad Request: title: … | Nom bo'sh yoki 128 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"])
print(requests.post(f"{API}/setChatTitle", json={"chat_id": GROUP_ID, "title": "Dasturchilar 2026"}, timeout=15).json())curl
curl -s -X POST "https://api.zamin.app/bot$ZAMIN_BOT_TOKEN/setChatTitle" \
-H "Content-Type: application/json" \
-d '{"chat_id": -4012345678, "title": "Dasturchilar 2026"}'