Turn send_cached_media async

This commit is contained in:
Dan 2019-03-11 21:27:25 +01:00
parent c6e4963ce0
commit 2078e6da28

View File

@ -27,7 +27,7 @@ from pyrogram.client.ext import BaseClient, utils
class SendCachedMedia(BaseClient): class SendCachedMedia(BaseClient):
def send_cached_media( async def send_cached_media(
self, self,
chat_id: Union[int, str], chat_id: Union[int, str],
file_id: str, file_id: str,
@ -114,9 +114,9 @@ class SendCachedMedia(BaseClient):
) )
) )
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=media, media=media,
silent=disable_notification or None, silent=disable_notification or None,
reply_to_msg_id=reply_to_message_id, reply_to_msg_id=reply_to_message_id,
@ -128,7 +128,7 @@ class SendCachedMedia(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}