mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-17 21:22:40 +00:00
Add missing awaits
This commit is contained in:
parent
654a432d99
commit
7f7f9768fd
@ -1362,7 +1362,7 @@ class Client(Methods, BaseClient):
|
||||
|
||||
if peer_id > 0:
|
||||
self.fetch_peers(
|
||||
self.send(
|
||||
await self.send(
|
||||
functions.users.GetUsers(
|
||||
id=[types.InputUser(user_id=peer_id, access_hash=0)]
|
||||
)
|
||||
@ -1370,13 +1370,13 @@ class Client(Methods, BaseClient):
|
||||
)
|
||||
else:
|
||||
if str(peer_id).startswith("-100"):
|
||||
self.send(
|
||||
await self.send(
|
||||
functions.channels.GetChannels(
|
||||
id=[types.InputChannel(channel_id=int(str(peer_id)[4:]), access_hash=0)]
|
||||
)
|
||||
)
|
||||
else:
|
||||
self.send(
|
||||
await self.send(
|
||||
functions.messages.GetChats(
|
||||
id=[-peer_id]
|
||||
)
|
||||
|
@ -67,7 +67,7 @@ class EditMessageCaption(BaseClient):
|
||||
peer=await self.resolve_peer(chat_id),
|
||||
id=message_id,
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -353,7 +353,7 @@ class EditMessageMedia(BaseClient):
|
||||
id=message_id,
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
media=media,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -72,7 +72,7 @@ class EditMessageText(BaseClient):
|
||||
id=message_id,
|
||||
no_webpage=disable_web_page_preview or None,
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(text)
|
||||
**await style.parse(text)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -187,7 +187,7 @@ class SendAnimation(BaseClient):
|
||||
reply_to_msg_id=reply_to_message_id,
|
||||
random_id=self.rnd_id(),
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
except FilePartMissing as e:
|
||||
|
@ -186,7 +186,7 @@ class SendAudio(BaseClient):
|
||||
reply_to_msg_id=reply_to_message_id,
|
||||
random_id=self.rnd_id(),
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
except FilePartMissing as e:
|
||||
|
@ -122,7 +122,7 @@ class SendCachedMedia(BaseClient):
|
||||
reply_to_msg_id=reply_to_message_id,
|
||||
random_id=self.rnd_id(),
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -167,7 +167,7 @@ class SendDocument(BaseClient):
|
||||
reply_to_msg_id=reply_to_message_id,
|
||||
random_id=self.rnd_id(),
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
except FilePartMissing as e:
|
||||
|
@ -183,7 +183,7 @@ class SendMediaGroup(BaseClient):
|
||||
types.InputSingleMedia(
|
||||
media=media,
|
||||
random_id=self.rnd_id(),
|
||||
**style.parse(i.caption)
|
||||
**await style.parse(i.caption)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -76,7 +76,7 @@ class SendMessage(BaseClient):
|
||||
:class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
|
||||
"""
|
||||
style = self.html if parse_mode.lower() == "html" else self.markdown
|
||||
message, entities = style.parse(text).values()
|
||||
message, entities = (await style.parse(text)).values()
|
||||
|
||||
r = await self.send(
|
||||
functions.messages.SendMessage(
|
||||
|
@ -164,7 +164,7 @@ class SendPhoto(BaseClient):
|
||||
reply_to_msg_id=reply_to_message_id,
|
||||
random_id=self.rnd_id(),
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
except FilePartMissing as e:
|
||||
|
@ -190,7 +190,7 @@ class SendVideo(BaseClient):
|
||||
reply_to_msg_id=reply_to_message_id,
|
||||
random_id=self.rnd_id(),
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
except FilePartMissing as e:
|
||||
|
@ -166,7 +166,7 @@ class SendVoice(BaseClient):
|
||||
reply_to_msg_id=reply_to_message_id,
|
||||
random_id=self.rnd_id(),
|
||||
reply_markup=reply_markup.write() if reply_markup else None,
|
||||
**style.parse(caption)
|
||||
**await style.parse(caption)
|
||||
)
|
||||
)
|
||||
except FilePartMissing as e:
|
||||
|
@ -40,9 +40,9 @@ class HTML:
|
||||
def __init__(self, client: "pyrogram.BaseClient" = None):
|
||||
self.client = client
|
||||
|
||||
def parse(self, message: str):
|
||||
entities = []
|
||||
async def parse(self, message: str):
|
||||
message = utils.add_surrogates(str(message or ""))
|
||||
entities = []
|
||||
offset = 0
|
||||
|
||||
for match in self.HTML_RE.finditer(message):
|
||||
@ -56,7 +56,7 @@ class HTML:
|
||||
user_id = int(mention.group(1))
|
||||
|
||||
try:
|
||||
input_user = self.client.resolve_peer(user_id)
|
||||
input_user = await self.client.resolve_peer(user_id)
|
||||
except PeerIdInvalid:
|
||||
input_user = None
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Markdown:
|
||||
def __init__(self, client: "pyrogram.BaseClient" = None):
|
||||
self.client = client
|
||||
|
||||
def parse(self, message: str):
|
||||
async def parse(self, message: str):
|
||||
message = utils.add_surrogates(str(message or "")).strip()
|
||||
entities = []
|
||||
offset = 0
|
||||
@ -73,7 +73,7 @@ class Markdown:
|
||||
user_id = int(mention.group(1))
|
||||
|
||||
try:
|
||||
input_user = self.client.resolve_peer(user_id)
|
||||
input_user = await self.client.resolve_peer(user_id)
|
||||
except PeerIdInvalid:
|
||||
input_user = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user