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 identifier
New score, must be non-negative
Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters.
Pass True if the game message should not be automatically edited to include the current scoreboard
Required if inline_message_id is not specified. Unique identifier for the target chat.
Required if inline_message_id is not specified. Identifier of the sent message.
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"
}
}
}