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