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.
parameters
| parameter | type | required | description |
|---|---|---|---|
user_id | number | required | User identifier |
score | number | required | New score, must be non-negative |
force | boolean | optional | Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters. |
disable_edit_message | boolean | optional | Pass True if the game message should not be automatically edited to include the current scoreboard |
chat_id | number | optional | Required if inline_message_id is not specified. Unique identifier for the target chat. |
message_id | number | optional | Required if inline_message_id is not specified. Identifier of the sent message. |
inline_message_id | string | optional | Required if chat_id and message_id are not specified. Identifier of the inline message. |
returns
Message | boolean
usage in yaebal
not (yet) hard-typed on Api — call it through the generic .call<T>() escape hatch documented in @yaebal/types.
import type { Message, SetGameScoreParams } from "@yaebal/types";
await bot.api.call<Message | boolean>("setGameScore", {
user_id: 123456789,
score: 1,
} satisfies SetGameScoreParams);context shortcut
also available as ctx.setGameScore() on
16
context types — see @yaebal/contexts.
/** 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](https://core.telegram.org/bots/api/#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*. */
ctx.setGameScore(params: Omit<SetGameScoreParams, "user_id" | "chat_id" | "message_id">)official Bot API docs: https://core.telegram.org/bots/api/#setgamescore