sendGame
Envia um jogo.
Retorno: Em caso de sucesso, retorna Message.
Parâmetros
| Parâmetro | Tipo | Obrigatório | Descrição |
|---|---|---|---|
business_connection_id | String | Opcional | ID da conexão comercial |
chat_id | Integer or String | Sim | Chat ID ou @username |
message_thread_id | Integer | Opcional | ID do tópico do fórum |
game_short_name | String | Sim | Nome curto do jogo |
disable_notification | Boolean | Opcional | Enviar sem som |
protect_content | Boolean | Opcional | Proteger conteúdo |
allow_paid_broadcast | Boolean | Opcional | Permitir transmissão paga |
message_effect_id | String | Opcional | ID do efeito da mensagem |
reply_parameters | ReplyParameters | Opcional | Objeto JSON ReplyParameters |
reply_markup | InlineKeyboardMarkup | Opcional | Objeto JSON InlineKeyboardMarkup |
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
Métodos relacionados
setGameScoreDefine a pontuação de um usuário no jogo.getGameHighScoresRetorna as melhores pontuações do jogo.