Telegram Bot API
🌐 Português

sendGame

Categoria: Jogos · Bot API 10.3 · Documentação oficial

Envia um jogo.

Retorno: Em caso de sucesso, retorna Message.

Parâmetros

ParâmetroTipoObrigatórioDescrição
business_connection_idStringOpcionalID da conexão comercial
chat_idInteger or StringSimChat ID ou @username
message_thread_idIntegerOpcionalID do tópico do fórum
game_short_nameStringSimNome curto do jogo
disable_notificationBooleanOpcionalEnviar sem som
protect_contentBooleanOpcionalProteger conteúdo
allow_paid_broadcastBooleanOpcionalPermitir transmissão paga
message_effect_idStringOpcionalID do efeito da mensagem
reply_parametersReplyParametersOpcionalObjeto JSON ReplyParameters
reply_markupInlineKeyboardMarkupOpcionalObjeto JSON InlineKeyboardMarkup

As descrições dos parâmetros são resumos concisos; consulte a documentação oficial para ver o texto completo.

Exemplo de requisição

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());

Guia passo a passo: Como criar um bot no Telegram grátis: do BotFather à primeira mensagem