promoteChatMember
Thăng cấp thành viên chat lên quản trị viên.
Giá trị trả về: Nếu thành công, trả về True.
Tham số
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
chat_id | Integer or String | Có | ID chat |
user_id | Integer | Có | ID người dùng |
is_anonymous | Boolean | Tùy chọn | Quản trị viên ẩn danh |
can_manage_chat | Boolean | Tùy chọn | Có thể quản lý chat |
can_delete_messages | Boolean | Tùy chọn | Có thể xóa tin nhắn |
can_manage_video_chats | Boolean | Tùy chọn | Có thể quản lý video chat |
can_restrict_members | Boolean | Tùy chọn | Có thể hạn chế thành viên |
can_promote_members | Boolean | Tùy chọn | Có thể thăng cấp thành viên |
can_change_info | Boolean | Tùy chọn | Có thể thay đổi thông tin chat |
can_invite_users | Boolean | Tùy chọn | Có thể mời người dùng |
can_post_stories | Boolean | Tùy chọn | Có thể đăng story |
can_edit_stories | Boolean | Tùy chọn | Có thể chỉnh sửa story |
can_delete_stories | Boolean | Tùy chọn | Có thể xóa story |
can_post_messages | Boolean | Tùy chọn | Có thể đăng tin nhắn (kênh) |
can_edit_messages | Boolean | Tùy chọn | Có thể chỉnh sửa tin nhắn (kênh) |
can_pin_messages | Boolean | Tùy chọn | Có thể ghim tin nhắn |
can_manage_topics | Boolean | Tùy chọn | Có thể quản lý chủ đề |
can_manage_direct_messages | Boolean | Tùy chọn | Có thể quản lý tin nhắn trực tiếp (Bot API 10.0) |
can_manage_tags | Boolean | Tùy chọn | Có thể quản lý thẻ (Bot API 9.5) |
can_send_welcome_messages | Boolean | Tùy chọn | Có thể quản lý tin nhắn chào mừng của chat (Bot API 10.3) |
Ví dụ request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/promoteChatMember" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"user_id":123456789}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/promoteChatMember",
json={
"chat_id": 123456789,
"user_id": 123456789
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/promoteChatMember`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"user_id": 123456789
}),
});
console.log(await res.json());
Hướng dẫn từng bước: Cách tạo bot Telegram từ A đến Z: BotFather, token và tin nhắn đầu tiên
Phương thức liên quan
banChatMemberCấm thành viên chat.unbanChatMemberBỏ cấm thành viên chat.restrictChatMemberHạn chế thành viên chat.setChatAdministratorCustomTitleĐặt chức danh tùy chỉnh cho quản trị viên.banChatSenderChatCấm một kênh trong nhóm/siêu nhóm.unbanChatSenderChatBỏ cấm một kênh trong nhóm/siêu nhóm.pinChatMessageGhim tin nhắn trong chat.unpinChatMessageBỏ ghim tin nhắn trong chat.unpinAllChatMessagesBỏ ghim tất cả tin nhắn trong chat.setChatMemberTagĐặt thẻ cho thành viên chat (Bot API 9.5).