getChatAdministrators
获取聊天中所有管理员列表。
请求
POST /:token/getchatadministrators
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| chat_id | Integer/String | 是 | 目标聊天的唯一标识符或用户名 |
响应
返回 ChatMember 对象数组。
json
{
"ok": true,
"result": [
{
"user": {
"id": 100000001,
"is_bot": false,
"first_name": "群主",
"username": "owner"
},
"status": "creator",
"custom_title": "创建者",
"is_anonymous": false
},
{
"user": {
"id": 100000002,
"is_bot": false,
"first_name": "管理员A",
"username": "admin_a"
},
"status": "administrator",
"custom_title": "技术负责人",
"is_anonymous": false,
"can_manage_chat": true,
"can_post_messages": true,
"can_edit_messages": true,
"can_delete_messages": true,
"can_manage_video_chats": true,
"can_restrict_members": true,
"can_promote_members": false,
"can_change_info": true,
"can_invite_users": true,
"can_pin_messages": true
},
{
"user": {
"id": 123456789,
"is_bot": true,
"first_name": "MyBot",
"username": "my_bot"
},
"status": "administrator",
"custom_title": "",
"is_anonymous": false,
"can_manage_chat": true,
"can_post_messages": false,
"can_edit_messages": false,
"can_delete_messages": true,
"can_manage_video_chats": false,
"can_restrict_members": true,
"can_promote_members": false,
"can_change_info": false,
"can_invite_users": true,
"can_pin_messages": true
}
]
}错误码
| 错误码 | 描述 |
|---|---|
| 400 | 请求参数错误,如 chat_id 格式不正确 |
| 401 | Token 无效或已过期 |
| 403 | Bot 不是该聊天的成员,无权获取信息 |
| 404 | 聊天不存在 |
| 500 | 服务器内部错误 |
示例
cURL
bash
curl -X POST "https://api.example.com/<token>/getchatadministrators" \
-H "Content-Type: application/json" \
-d '{
"chat_id": -1001234567890
}'