StaticGramBot API

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

Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.

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

per-chat scoreboard (both boxes of a private chat share it), force, BOT_SCORE_NOT_MODIFIED; the game message is not auto-edited (disable_edit_message ignored)

Параметры

user_idIntegerобязательный
User identifier
scoreIntegerобязательный
New score, must be non-negative
forceBooleanнеобязательный
Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters.
disable_edit_messageBooleanнеобязательный
Pass True if the game message should not be automatically edited to include the current scoreboard
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/setGameScore" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 123456789,
    "score": 100
  }'
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.set_game_score(user_id=123456789, score=100)
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/setGameScore`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "user_id": 123456789,
    "score": 100
  }),
});
const data = await res.json();

Ответ (Message)

JSON
{
  "ok": true,
  "result": {
    "message_id": 1,
    "date": 1790000000,
    "chat": {
      "id": 1780243423,
      "type": "private"
    }
  }
}

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