getGameHighScores
Get a game's high score data. Returns the target user plus several entries from their neighboring ranks.
Request
POST /:token/getGameHighScores
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| user_id | Integer | Yes | Unique identifier of the target user |
| chat_id | Integer | No | Required when inline_message_id is not specified: the chat that contains the game card |
| message_id | Integer | No | Required when inline_message_id is not specified: the message ID of the game card |
| inline_message_id | String | No | Required when chat_id and message_id are not specified: the inline message identifier |
Provide either
chat_id+message_idorinline_message_id.
Response
Returns an array of GameHighScore objects. The result includes the target user and several neighbors on each side; if the target user and their neighbors are not at the top, several top-ranked users are also included.
json
{
"ok": true,
"result": [
{ "position": 1, "user": { "id": 111, "first_name": "Alice" }, "score": 980 },
{ "position": 2, "user": { "id": 222, "first_name": "Bob" }, "score": 760 },
{ "position": 3, "user": { "id": 333, "first_name": "Carol" }, "score": 540 }
]
}Error Codes
| Code | Description |
|---|---|
| 400 | Bad request parameters, e.g. missing carrier parameters or the game does not exist |
| 401 | Invalid or expired token |
| 403 | Bot does not have permission to view this game's high scores |
| 404 | User, chat, or message does not exist |
| 500 | Internal server error |
Examples
cURL
bash
curl -X POST "https://api.safew.bot/<token>/getGameHighScores" \
-H "Content-Type: application/json" \
-d '{
"user_id": 111222333,
"chat_id": 987654321,
"message_id": 100
}'