Add get_game_high_scores method

This commit is contained in:
Dan 2019-01-07 22:28:41 +01:00
parent 65bdf31ce1
commit 633fefe178
3 changed files with 66 additions and 3 deletions

View File

@ -140,6 +140,7 @@ Bots
request_callback_answer
send_game
set_game_score
get_game_high_scores
.. autoclass:: pyrogram.Client

View File

@ -24,6 +24,7 @@ from .edit_message_media import EditMessageMedia
from .edit_message_reply_markup import EditMessageReplyMarkup
from .edit_message_text import EditMessageText
from .forward_messages import ForwardMessages
from .get_game_high_scores import GetGameHighScores
from .get_history import GetHistory
from .get_messages import GetMessages
from .iter_history import IterHistory
@ -33,7 +34,7 @@ from .send_audio import SendAudio
from .send_chat_action import SendChatAction
from .send_contact import SendContact
from .send_document import SendDocument
from .send_game import SendGame
from pyrogram.client.methods.bots.send_game import SendGame
from .send_location import SendLocation
from .send_media_group import SendMediaGroup
from .send_message import SendMessage
@ -44,8 +45,8 @@ from .send_venue import SendVenue
from .send_video import SendVideo
from .send_video_note import SendVideoNote
from .send_voice import SendVoice
from pyrogram.client.methods.bots.set_game_score import SetGameScore
from .vote_poll import VotePoll
from .set_game_score import SetGameScore
class Messages(
@ -78,6 +79,7 @@ class Messages(
DownloadMedia,
IterHistory,
SendGame,
SetGameScore
SetGameScore,
GetGameHighScores
):
pass

View File

@ -0,0 +1,60 @@
# 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 Union
import pyrogram
from pyrogram.api import functions
from ...ext import BaseClient
class GetGameHighScores(BaseClient):
def get_game_high_scores(self,
user_id: Union[int, str],
chat_id: Union[int, str],
message_id: int = None):
"""Use this method to get data for high score tables.
Args:
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists in your Telegram address book you can use his phone number (str).
chat_id (``int`` | ``str``, *optional*):
Unique identifier (int) or username (str) of the target chat.
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists in your Telegram address book you can use his phone number (str).
Required if inline_message_id is not specified.
message_id (``int``, *optional*):
Identifier of the sent message.
Required if inline_message_id is not specified.
"""
# TODO: inline_message_id
return pyrogram.GameHighScores._parse(
self,
self.send(
functions.messages.GetGameHighScores(
peer=self.resolve_peer(chat_id),
id=message_id,
user_id=self.resolve_peer(user_id)
)
)
)