Remove GameHighScores type
This commit is contained in:
parent
cfbc5298df
commit
a769fdfd20
@ -71,7 +71,6 @@ Keyboards
|
|||||||
- :class:`ForceReply`
|
- :class:`ForceReply`
|
||||||
- :class:`CallbackQuery`
|
- :class:`CallbackQuery`
|
||||||
- :class:`GameHighScore`
|
- :class:`GameHighScore`
|
||||||
- :class:`GameHighScores`
|
|
||||||
- :class:`CallbackGame`
|
- :class:`CallbackGame`
|
||||||
|
|
||||||
Input Media
|
Input Media
|
||||||
@ -150,7 +149,6 @@ Details
|
|||||||
.. autoclass:: ForceReply()
|
.. autoclass:: ForceReply()
|
||||||
.. autoclass:: CallbackQuery()
|
.. autoclass:: CallbackQuery()
|
||||||
.. autoclass:: GameHighScore()
|
.. autoclass:: GameHighScore()
|
||||||
.. autoclass:: GameHighScores()
|
|
||||||
.. autoclass:: CallbackGame()
|
.. autoclass:: CallbackGame()
|
||||||
|
|
||||||
.. Input Media
|
.. Input Media
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union, List
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram.api import functions
|
from pyrogram.api import functions
|
||||||
@ -29,7 +29,7 @@ class GetGameHighScores(BaseClient):
|
|||||||
user_id: Union[int, str],
|
user_id: Union[int, str],
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
message_id: int = None
|
message_id: int = None
|
||||||
) -> "pyrogram.GameHighScores":
|
) -> List["pyrogram.GameHighScore"]:
|
||||||
"""Get data for high score tables.
|
"""Get data for high score tables.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
@ -49,20 +49,19 @@ class GetGameHighScores(BaseClient):
|
|||||||
Required if inline_message_id is not specified.
|
Required if inline_message_id is not specified.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
:obj:`GameHighScores`: On success.
|
List of :obj:`GameHighScore`: On success.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
RPCError: In case of a Telegram RPC error.
|
RPCError: In case of a Telegram RPC error.
|
||||||
"""
|
"""
|
||||||
# TODO: inline_message_id
|
# TODO: inline_message_id
|
||||||
|
|
||||||
return pyrogram.GameHighScores._parse(
|
r = self.send(
|
||||||
self,
|
functions.messages.GetGameHighScores(
|
||||||
self.send(
|
peer=self.resolve_peer(chat_id),
|
||||||
functions.messages.GetGameHighScores(
|
id=message_id,
|
||||||
peer=self.resolve_peer(chat_id),
|
user_id=self.resolve_peer(user_id)
|
||||||
id=message_id,
|
|
||||||
user_id=self.resolve_peer(user_id)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return pyrogram.List(pyrogram.GameHighScore._parse(self, score, r.users) for score in r.scores)
|
||||||
|
@ -20,7 +20,6 @@ from .callback_game import CallbackGame
|
|||||||
from .callback_query import CallbackQuery
|
from .callback_query import CallbackQuery
|
||||||
from .force_reply import ForceReply
|
from .force_reply import ForceReply
|
||||||
from .game_high_score import GameHighScore
|
from .game_high_score import GameHighScore
|
||||||
from .game_high_scores import GameHighScores
|
|
||||||
from .inline_keyboard_button import InlineKeyboardButton
|
from .inline_keyboard_button import InlineKeyboardButton
|
||||||
from .inline_keyboard_markup import InlineKeyboardMarkup
|
from .inline_keyboard_markup import InlineKeyboardMarkup
|
||||||
from .keyboard_button import KeyboardButton
|
from .keyboard_button import KeyboardButton
|
||||||
@ -28,6 +27,6 @@ from .reply_keyboard_markup import ReplyKeyboardMarkup
|
|||||||
from .reply_keyboard_remove import ReplyKeyboardRemove
|
from .reply_keyboard_remove import ReplyKeyboardRemove
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"CallbackGame", "CallbackQuery", "ForceReply", "GameHighScore", "GameHighScores", "InlineKeyboardButton",
|
"CallbackGame", "CallbackQuery", "ForceReply", "GameHighScore", "InlineKeyboardButton", "InlineKeyboardMarkup",
|
||||||
"InlineKeyboardMarkup", "KeyboardButton", "ReplyKeyboardMarkup", "ReplyKeyboardRemove"
|
"KeyboardButton", "ReplyKeyboardMarkup", "ReplyKeyboardRemove"
|
||||||
]
|
]
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
# Pyrogram - Telegram MTProto API Client Library for Python
|
|
||||||
# Copyright (C) 2017-2019 Dan Tès <https://github.com/delivrance>
|
|
||||||
#
|
|
||||||
# This file is part of Pyrogram.
|
|
||||||
#
|
|
||||||
# Pyrogram is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License as published
|
|
||||||
# by the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Pyrogram is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
import pyrogram
|
|
||||||
from pyrogram.api import types
|
|
||||||
from pyrogram.client.types.object import Object
|
|
||||||
from .game_high_score import GameHighScore
|
|
||||||
|
|
||||||
|
|
||||||
class GameHighScores(Object):
|
|
||||||
"""The high scores table for a game.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
total_count (``int``):
|
|
||||||
Total number of scores the target game has.
|
|
||||||
|
|
||||||
game_high_scores (List of :obj:`GameHighScore`):
|
|
||||||
Game scores.
|
|
||||||
"""
|
|
||||||
|
|
||||||
__slots__ = ["total_count", "game_high_scores"]
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
*,
|
|
||||||
client: "pyrogram.BaseClient" = None,
|
|
||||||
total_count: int,
|
|
||||||
game_high_scores: List[GameHighScore]
|
|
||||||
):
|
|
||||||
super().__init__(client)
|
|
||||||
|
|
||||||
self.total_count = total_count
|
|
||||||
self.game_high_scores = game_high_scores
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _parse(client, game_high_scores: types.messages.HighScores) -> "GameHighScores":
|
|
||||||
return GameHighScores(
|
|
||||||
total_count=len(game_high_scores.scores),
|
|
||||||
game_high_scores=[
|
|
||||||
GameHighScore._parse(client, score, game_high_scores.users)
|
|
||||||
for score in game_high_scores.scores],
|
|
||||||
client=client
|
|
||||||
)
|
|
Loading…
Reference in New Issue
Block a user