/
set_game_score.py
38 lines (30 loc) · 1.51 KB
/
set_game_score.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from typing import Any, Dict, Optional, Union
from ..types import Message
from .base import Request, TelegramMethod
class SetGameScore(TelegramMethod[Union[Message, bool]]):
"""
Use this method to set the score of the specified user in a game. On success, if the message
was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if
the new score is not greater than the user's current score in the chat and force is False.
Source: https://core.telegram.org/bots/api#setgamescore
"""
__returning__ = Union[Message, bool]
user_id: int
"""User identifier"""
score: int
"""New score, must be non-negative"""
force: Optional[bool] = None
"""Pass True, if the high score is allowed to decrease. This can be useful when fixing
mistakes or banning cheaters"""
disable_edit_message: Optional[bool] = None
"""Pass True, if the game message should not be automatically edited to include the current
scoreboard"""
chat_id: Optional[int] = None
"""Required if inline_message_id is not specified. Unique identifier for the target chat"""
message_id: Optional[int] = None
"""Required if inline_message_id is not specified. Identifier of the sent message"""
inline_message_id: Optional[str] = None
"""Required if chat_id and message_id are not specified. Identifier of the inline message"""
def build_request(self) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="setGameScore", data=data)