Telegram Bot API
🌐 Tiếng Việt

sendGame

Danh mục: Trò chơi · Bot API 10.3 · Tài liệu chính thức

Gửi trò chơi.

Giá trị trả về: Nếu thành công, trả về Message.

Tham số

Tham sốKiểuBắt buộcMô tả
business_connection_idStringTùy chọnID kết nối doanh nghiệp
chat_idInteger or StringCóID chat hoặc @username
message_thread_idIntegerTùy chọnID chủ đề diễn đàn
game_short_nameStringCóTên ngắn của trò chơi
disable_notificationBooleanTùy chọnGửi không âm thanh
protect_contentBooleanTùy chọnBảo vệ nội dung
allow_paid_broadcastBooleanTùy chọnCho phép gửi hàng loạt trả phí
message_effect_idStringTùy chọnID hiệu ứng tin nhắn
reply_parametersReplyParametersTùy chọnĐối tượng JSON ReplyParameters
reply_markupInlineKeyboardMarkupTùy chọnJSON: InlineKeyboardMarkup

Mô tả tham số chỉ là bản tóm tắt ngắn gọn; xem tài liệu chính thức để đọc toàn văn.

Ví dụ request

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendGame" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":123456789,"game_short_name":"mygame"}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/sendGame",
    json={
        "chat_id": 123456789,
        "game_short_name": "mygame"
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendGame`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "game_short_name": "mygame"
  }),
});
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