mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Rename game_score to game_high_score
This commit is contained in:
parent
ee472329a2
commit
8928ca3433
@ -172,8 +172,8 @@ class Filters:
|
|||||||
pinned_message = create("PinnedMessage", lambda _, m: bool(m.pinned_message))
|
pinned_message = create("PinnedMessage", lambda _, m: bool(m.pinned_message))
|
||||||
"""Filter service messages for pinned messages."""
|
"""Filter service messages for pinned messages."""
|
||||||
|
|
||||||
game_score = create("GameScore", lambda _, m: bool(m.game_score))
|
game_high_score = create("GameHighScore", lambda _, m: bool(m.game_high_score))
|
||||||
"""Filter service messages for game scores."""
|
"""Filter service messages for game high scores."""
|
||||||
|
|
||||||
reply_keyboard = create("ReplyKeyboard", lambda _, m: isinstance(m.reply_markup, ReplyKeyboardMarkup))
|
reply_keyboard = create("ReplyKeyboard", lambda _, m: isinstance(m.reply_markup, ReplyKeyboardMarkup))
|
||||||
"""Filter messages containing reply keyboard markups"""
|
"""Filter messages containing reply keyboard markups"""
|
||||||
|
@ -33,7 +33,7 @@ class GameHighScore(PyrogramType):
|
|||||||
score (``int``):
|
score (``int``):
|
||||||
Score.
|
Score.
|
||||||
|
|
||||||
position (``position``):
|
position (``position``, *optional*):
|
||||||
Position in high score table for the game.
|
Position in high score table for the game.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class GameHighScore(PyrogramType):
|
|||||||
client: "pyrogram.client.ext.BaseClient",
|
client: "pyrogram.client.ext.BaseClient",
|
||||||
user: User,
|
user: User,
|
||||||
score: int,
|
score: int,
|
||||||
position: int):
|
position: int = None):
|
||||||
super().__init__(client)
|
super().__init__(client)
|
||||||
|
|
||||||
self.user = user
|
self.user = user
|
||||||
@ -59,3 +59,11 @@ class GameHighScore(PyrogramType):
|
|||||||
position=game_high_score.pos,
|
position=game_high_score.pos,
|
||||||
client=client
|
client=client
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_action(client, service: types.MessageService, users: dict):
|
||||||
|
return GameHighScore(
|
||||||
|
user=User._parse(client, users[service.from_id]),
|
||||||
|
score=service.action.score,
|
||||||
|
client=client
|
||||||
|
)
|
||||||
|
@ -202,7 +202,7 @@ class Message(PyrogramType, Update):
|
|||||||
Note that the Message object in this field will not contain further reply_to_message fields even if it
|
Note that the Message object in this field will not contain further reply_to_message fields even if it
|
||||||
is itself a reply.
|
is itself a reply.
|
||||||
|
|
||||||
game_score (``int``, *optional*):
|
game_high_score (:obj:`GameHighScore <pyrogram.GameHighScore>`, *optional*):
|
||||||
The game score for a user.
|
The game score for a user.
|
||||||
The reply_to_message field will contain the game Message.
|
The reply_to_message field will contain the game Message.
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ class Message(PyrogramType, Update):
|
|||||||
migrate_to_chat_id: int = None,
|
migrate_to_chat_id: int = None,
|
||||||
migrate_from_chat_id: int = None,
|
migrate_from_chat_id: int = None,
|
||||||
pinned_message: "Message" = None,
|
pinned_message: "Message" = None,
|
||||||
game_score: int = None,
|
game_high_score: int = None,
|
||||||
views: int = None,
|
views: int = None,
|
||||||
via_bot: User = None,
|
via_bot: User = None,
|
||||||
outgoing: bool = None,
|
outgoing: bool = None,
|
||||||
@ -341,7 +341,7 @@ class Message(PyrogramType, Update):
|
|||||||
self.migrate_to_chat_id = migrate_to_chat_id
|
self.migrate_to_chat_id = migrate_to_chat_id
|
||||||
self.migrate_from_chat_id = migrate_from_chat_id
|
self.migrate_from_chat_id = migrate_from_chat_id
|
||||||
self.pinned_message = pinned_message
|
self.pinned_message = pinned_message
|
||||||
self.game_score = game_score
|
self.game_high_score = game_high_score
|
||||||
self.views = views
|
self.views = views
|
||||||
self.via_bot = via_bot
|
self.via_bot = via_bot
|
||||||
self.outgoing = outgoing
|
self.outgoing = outgoing
|
||||||
@ -419,7 +419,7 @@ class Message(PyrogramType, Update):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if isinstance(action, types.MessageActionGameScore):
|
if isinstance(action, types.MessageActionGameScore):
|
||||||
parsed_message.game_score = action.score
|
parsed_message.game_high_score = pyrogram.GameHighScore._parse_action(client, message, users)
|
||||||
|
|
||||||
if message.reply_to_msg_id and replies:
|
if message.reply_to_msg_id and replies:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user