Skip to content

setChatAdministratorCustomTitle

设置管理员的自定义头衔。

请求

POST /:token/setchatadministratorcustomtitle

参数

参数类型必填描述
chat_idInteger/String目标聊天的唯一标识符或用户名
user_idInteger目标管理员用户的唯一标识符
custom_titleString管理员的自定义头衔,长度 0-16 字符。设为空字符串可清除自定义头衔

响应

成功时返回 Boolean 值 true

json
{
  "ok": true,
  "result": true
}

错误码

错误码描述
400请求参数错误,如 custom_title 超过 16 字符或目标用户不是管理员
401Token 无效或已过期
403Bot 没有足够的管理员权限来执行此操作
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": ""
  }'