getGameHighScores
Devuelve las mejores puntuaciones de un juego.
Devuelve: Si la llamada tiene éxito, devuelve Array of GameHighScore.
Parámetros
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
user_id | Integer | Sí | ID del usuario |
chat_id | Integer | Opcional | ID del chat |
message_id | Integer | Opcional | ID del mensaje |
inline_message_id | String | Opcional | ID del mensaje inline |
Ejemplo de solicitud
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/getGameHighScores" \
-H "Content-Type: application/json" \
-d '{"user_id":123456789}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/getGameHighScores",
json={
"user_id": 123456789
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/getGameHighScores`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"user_id": 123456789
}),
});
console.log(await res.json());
Guía paso a paso: Cómo crear un bot en Telegram paso a paso: de BotFather a tu primer mensaje
Métodos relacionados
sendGameEnvía un juego.setGameScoreEstablece la puntuación de un usuario en un juego.