mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 07:24:51 +00:00
Make get_dialogs async
This commit is contained in:
parent
3f22d1b844
commit
f2d64b2573
1 changed files with 7 additions and 7 deletions
|
|
@ -24,12 +24,12 @@ from ...ext import BaseClient, utils
|
||||||
class GetDialogs(BaseClient):
|
class GetDialogs(BaseClient):
|
||||||
# TODO docstrings
|
# TODO docstrings
|
||||||
|
|
||||||
def get_dialogs(self,
|
async def get_dialogs(self,
|
||||||
limit: int = 100,
|
limit: int = 100,
|
||||||
pinned_only: bool = False,
|
pinned_only: bool = False,
|
||||||
last_chunk=None):
|
last_chunk=None):
|
||||||
if pinned_only:
|
if pinned_only:
|
||||||
r = self.send(functions.messages.GetPinnedDialogs())
|
r = await self.send(functions.messages.GetPinnedDialogs())
|
||||||
else:
|
else:
|
||||||
offset_date = 0
|
offset_date = 0
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ class GetDialogs(BaseClient):
|
||||||
offset_date = message_date
|
offset_date = message_date
|
||||||
break
|
break
|
||||||
|
|
||||||
r = self.send(
|
r = await self.send(
|
||||||
functions.messages.GetDialogs(
|
functions.messages.GetDialogs(
|
||||||
offset_date=offset_date,
|
offset_date=offset_date,
|
||||||
offset_id=0,
|
offset_id=0,
|
||||||
|
|
@ -72,7 +72,7 @@ class GetDialogs(BaseClient):
|
||||||
else:
|
else:
|
||||||
chat_id = int("-100" + str(to_id.channel_id))
|
chat_id = int("-100" + str(to_id.channel_id))
|
||||||
|
|
||||||
messages[chat_id] = utils.parse_messages(self, message, users, chats)
|
messages[chat_id] = await utils.parse_messages(self, message, users, chats)
|
||||||
|
|
||||||
dialogs = []
|
dialogs = []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue