StaticGramBot API

getGameHighScoresПоддерживается

Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.

This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.

Особенности StaticGram

top 3 + target ±2

Параметры

user_idIntegerобязательный
Target user id
chat_idIntegerнеобязательный
Required if inline_message_id is not specified. Unique identifier for the target chat.
message_idIntegerнеобязательный
Required if inline_message_id is not specified. Identifier of the sent message.
inline_message_idStringнеобязательный
Required if chat_id and message_id are not specified. Identifier of the inline message.

Пример запроса

curl
curl "https://api.staticgram.top/bot$TOKEN/getGameHighScores" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 123456789
  }'
aiogram 3
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer

session = AiohttpSession(api=TelegramAPIServer.from_base("https://api.staticgram.top"))
bot = Bot(TOKEN, session=session)

result = await bot.get_game_high_scores(user_id=123456789)
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/getGameHighScores`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "user_id": 123456789
  }),
});
const data = await res.json();

Ответ (Array of GameHighScore)

JSON
{
  "ok": true,
  "result": [
    {
      "position": 1,
      "user": {
        "id": 1780243423,
        "is_bot": true,
        "first_name": "..."
      },
      "score": 1
    }
  ]
}

Описания методов и типов взяты из официальной документации Telegram Bot API (Bot API 10.3). Адрес API: https://api.staticgram.top