setChatAdministratorCustomTitle
设置管理员的自定义头衔。
请求
POST /:token/setchatadministratorcustomtitle
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| chat_id | Integer/String | 是 | 目标聊天的唯一标识符或用户名 |
| user_id | Integer | 是 | 目标管理员用户的唯一标识符 |
| custom_title | String | 是 | 管理员的自定义头衔,长度 0-16 字符。设为空字符串可清除自定义头衔 |
响应
成功时返回 Boolean 值 true。
json
{
"ok": true,
"result": true
}错误码
| 错误码 | 描述 |
|---|---|
| 400 | 请求参数错误,如 custom_title 超过 16 字符或目标用户不是管理员 |
| 401 | Token 无效或已过期 |
| 403 | Bot 没有足够的管理员权限来执行此操作 |
| 404 | 聊天或用户不存在 |
| 500 | 服务器内部错误 |
示例
cURL
设置自定义头衔
bash
curl -X POST "https://api.example.com/<token>/setchatadministratorcustomtitle" \
-H "Content-Type: application/json" \
-d '{
"chat_id": -1001234567890,
"user_id": 987654321,
"custom_title": "技术负责人"
}'清除自定义头衔
bash
curl -X POST "https://api.example.com/<token>/setchatadministratorcustomtitle" \
-H "Content-Type: application/json" \
-d '{
"chat_id": -1001234567890,
"user_id": 987654321,
"custom_title": ""
}'