From eddff4769cd2098bb51f82e674e78a9050b535c9 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 1 Aug 2019 10:43:09 +0200 Subject: [PATCH 1/2] Add missing async/await --- pyrogram/client/parser/parser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyrogram/client/parser/parser.py b/pyrogram/client/parser/parser.py index 371c4791..21d09b42 100644 --- a/pyrogram/client/parser/parser.py +++ b/pyrogram/client/parser/parser.py @@ -30,7 +30,7 @@ class Parser: self.html = HTML(client) self.markdown = Markdown(client) - def parse(self, text: str, mode: Union[str, None] = object): + async def parse(self, text: str, mode: Union[str, None] = object): text = str(text).strip() if mode == object: @@ -48,13 +48,13 @@ class Parser: mode = mode.lower() if mode == "combined": - return self.markdown.parse(text) + return await self.markdown.parse(text) if mode in ["markdown", "md"]: - return self.markdown.parse(text, True) + return await self.markdown.parse(text, True) if mode == "html": - return self.html.parse(text) + return await self.html.parse(text) raise ValueError('parse_mode must be one of {} or None. Not "{}"'.format( ", ".join('"{}"'.format(m) for m in pyrogram.Client.PARSE_MODES[:-1]), From 73e8b8c66e10ce4ab6bd1d75c62e935ae83d33ba Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 1 Aug 2019 20:18:17 +0200 Subject: [PATCH 2/2] Update read_history.py --- pyrogram/client/methods/messages/read_history.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrogram/client/methods/messages/read_history.py b/pyrogram/client/methods/messages/read_history.py index f5dc8630..7fa99dc9 100644 --- a/pyrogram/client/methods/messages/read_history.py +++ b/pyrogram/client/methods/messages/read_history.py @@ -23,7 +23,7 @@ from ...ext import BaseClient class ReadHistory(BaseClient): - def read_history( + async def read_history( self, chat_id: Union[int, str], max_id: int = 0 @@ -53,7 +53,7 @@ class ReadHistory(BaseClient): app.read_history("pyrogramlounge", 123456) """ - peer = self.resolve_peer(chat_id) + peer = await self.resolve_peer(chat_id) if isinstance(peer, types.InputPeerChannel): q = functions.channels.ReadHistory( @@ -66,6 +66,6 @@ class ReadHistory(BaseClient): max_id=max_id ) - self.send(q) + await self.send(q) return True