mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-17 21:22:40 +00:00
Fix asyncio merge
This commit is contained in:
parent
21c301d19d
commit
35096a28c3
@ -96,29 +96,29 @@ class BaseClient:
|
||||
|
||||
self.disconnect_handler = None
|
||||
|
||||
def send(self, *args, **kwargs):
|
||||
async def send(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def resolve_peer(self, *args, **kwargs):
|
||||
async def resolve_peer(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def fetch_peers(self, *args, **kwargs):
|
||||
async def fetch_peers(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def add_handler(self, *args, **kwargs):
|
||||
async def add_handler(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def save_file(self, *args, **kwargs):
|
||||
async def save_file(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def get_messages(self, *args, **kwargs):
|
||||
async def get_messages(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def get_history(self, *args, **kwargs):
|
||||
async def get_history(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def get_dialogs(self, *args, **kwargs):
|
||||
async def get_dialogs(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def get_chat_members(self, *args, **kwargs):
|
||||
async def get_chat_members(self, *args, **kwargs):
|
||||
pass
|
||||
|
@ -24,10 +24,10 @@ from pyrogram.client.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):
|
||||
async 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:
|
||||
@ -56,11 +56,11 @@ class GetGameHighScores(BaseClient):
|
||||
|
||||
return pyrogram.GameHighScores._parse(
|
||||
self,
|
||||
self.send(
|
||||
await self.send(
|
||||
functions.messages.GetGameHighScores(
|
||||
peer=self.resolve_peer(chat_id),
|
||||
peer=await self.resolve_peer(chat_id),
|
||||
id=message_id,
|
||||
user_id=self.resolve_peer(user_id)
|
||||
user_id=await self.resolve_peer(user_id)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -24,15 +24,15 @@ from pyrogram.client.ext import BaseClient
|
||||
|
||||
|
||||
class SendGame(BaseClient):
|
||||
def send_game(self,
|
||||
chat_id: Union[int, str],
|
||||
game_short_name: str,
|
||||
disable_notification: bool = None,
|
||||
reply_to_message_id: int = None,
|
||||
reply_markup: Union["pyrogram.InlineKeyboardMarkup",
|
||||
"pyrogram.ReplyKeyboardMarkup",
|
||||
"pyrogram.ReplyKeyboardRemove",
|
||||
"pyrogram.ForceReply"] = None) -> "pyrogram.Message":
|
||||
async def send_game(self,
|
||||
chat_id: Union[int, str],
|
||||
game_short_name: str,
|
||||
disable_notification: bool = None,
|
||||
reply_to_message_id: int = None,
|
||||
reply_markup: Union["pyrogram.InlineKeyboardMarkup",
|
||||
"pyrogram.ReplyKeyboardMarkup",
|
||||
"pyrogram.ReplyKeyboardRemove",
|
||||
"pyrogram.ForceReply"] = None) -> "pyrogram.Message":
|
||||
"""Use this method to send a game.
|
||||
|
||||
Args:
|
||||
@ -61,9 +61,9 @@ class SendGame(BaseClient):
|
||||
Raises:
|
||||
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
|
||||
"""
|
||||
r = self.send(
|
||||
r = await self.send(
|
||||
functions.messages.SendMedia(
|
||||
peer=self.resolve_peer(chat_id),
|
||||
peer=await self.resolve_peer(chat_id),
|
||||
media=types.InputMediaGame(
|
||||
id=types.InputGameShortName(
|
||||
bot_id=types.InputUserSelf(),
|
||||
@ -80,7 +80,7 @@ class SendGame(BaseClient):
|
||||
|
||||
for i in r.updates:
|
||||
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
|
||||
return pyrogram.Message._parse(
|
||||
return await pyrogram.Message._parse(
|
||||
self, i.message,
|
||||
{i.id: i for i in r.users},
|
||||
{i.id: i for i in r.chats}
|
||||
|
@ -24,13 +24,13 @@ from pyrogram.client.ext import BaseClient
|
||||
|
||||
|
||||
class SetGameScore(BaseClient):
|
||||
def set_game_score(self,
|
||||
user_id: Union[int, str],
|
||||
score: int,
|
||||
force: bool = None,
|
||||
disable_edit_message: bool = None,
|
||||
chat_id: Union[int, str] = None,
|
||||
message_id: int = None):
|
||||
async def set_game_score(self,
|
||||
user_id: Union[int, str],
|
||||
score: int,
|
||||
force: bool = None,
|
||||
disable_edit_message: bool = None,
|
||||
chat_id: Union[int, str] = None,
|
||||
message_id: int = None):
|
||||
# inline_message_id: str = None): TODO Add inline_message_id
|
||||
"""Use this method to set the score of the specified user in a game.
|
||||
|
||||
@ -68,12 +68,12 @@ class SetGameScore(BaseClient):
|
||||
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
|
||||
:class:`BotScoreNotModified` if the new score is not greater than the user's current score in the chat and force is False.
|
||||
"""
|
||||
r = self.send(
|
||||
r = await self.send(
|
||||
functions.messages.SetGameScore(
|
||||
peer=self.resolve_peer(chat_id),
|
||||
peer=await self.resolve_peer(chat_id),
|
||||
score=score,
|
||||
id=message_id,
|
||||
user_id=self.resolve_peer(user_id),
|
||||
user_id=await self.resolve_peer(user_id),
|
||||
force=force or None,
|
||||
edit_message=not disable_edit_message or None
|
||||
)
|
||||
@ -81,7 +81,7 @@ class SetGameScore(BaseClient):
|
||||
|
||||
for i in r.updates:
|
||||
if isinstance(i, (types.UpdateEditMessage, types.UpdateEditChannelMessage)):
|
||||
return pyrogram.Message._parse(
|
||||
return await pyrogram.Message._parse(
|
||||
self, i.message,
|
||||
{i.id: i for i in r.users},
|
||||
{i.id: i for i in r.chats}
|
||||
|
@ -423,7 +423,7 @@ class Message(PyrogramType, Update):
|
||||
|
||||
if message.reply_to_msg_id and replies:
|
||||
try:
|
||||
parsed_message.reply_to_message = client.get_messages(
|
||||
parsed_message.reply_to_message = await client.get_messages(
|
||||
parsed_message.chat.id,
|
||||
reply_to_message_ids=message.id,
|
||||
replies=0
|
||||
@ -912,7 +912,11 @@ class Message(PyrogramType, Update):
|
||||
else:
|
||||
raise ValueError("The message doesn't contain any keyboard")
|
||||
|
||||
async def download(self, file_name: str = "", block: bool = True, progress: callable = None, progress_args: tuple = None):
|
||||
async def download(self,
|
||||
file_name: str = "",
|
||||
block: bool = True,
|
||||
progress: callable = None,
|
||||
progress_args: tuple = None):
|
||||
"""Bound method *download* of :obj:`Message <pyrogram.Message>`.
|
||||
|
||||
Use as a shortcut for:
|
||||
|
Loading…
Reference in New Issue
Block a user