mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-17 05:08:02 +00:00
Merge remote-tracking branch 'origin/asyncio-dev' into asyncio-dev
This commit is contained in:
commit
1540fd4f22
@ -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
|
||||
|
@ -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]),
|
||||
|
Loading…
Reference in New Issue
Block a user