Skip to content

Commit 14eb285

Browse files
Commit message
Ref: https://t.me/c/1220993104/1382620/1384317 Co-authored-by: anonymousx97 <[email protected]>
1 parent d41206c commit 14eb285

16 files changed

+40
-3
lines changed

pyrogram/methods/business/get_user_gifts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from typing import Union, Optional, AsyncGenerator
2021

2122
import pyrogram
@@ -83,6 +84,7 @@ async def get_user_gifts(
8384
return
8485

8586
for user_gift in user_gifts:
87+
await sleep(0)
8688
yield user_gift
8789

8890
current += 1

pyrogram/methods/chat_topics/get_forum_topics.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from datetime import datetime
2021
from typing import Union, AsyncGenerator
2122

@@ -125,6 +126,7 @@ async def get_forum_topics(
125126
offset_message_thread_id = last.message_thread_id
126127

127128
for topic in topics:
129+
await sleep(0)
128130
yield topic
129131

130132
current += 1

pyrogram/methods/chats/get_chat_event_log.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from typing import Union, AsyncGenerator, Optional
2021

2122
import pyrogram
@@ -101,6 +102,7 @@ async def get_chat_event_log(
101102
offset_id = last.id
102103

103104
for event in r.events:
105+
await sleep(0)
104106
yield await types.ChatEvent._parse(self, event, r.users, r.chats)
105107

106108
current += 1

pyrogram/methods/chats/get_chat_members.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

1919
import logging
20+
from asyncio import sleep
2021
from typing import Union, Optional, AsyncGenerator
2122

2223
import pyrogram
@@ -125,6 +126,7 @@ async def get_chat_members(
125126
users = {i.id: i for i in r.users}
126127

127128
for member in members:
129+
await sleep(0)
128130
yield types.ChatMember._parse(self, member, users, {})
129131

130132
return
@@ -150,6 +152,7 @@ async def get_chat_members(
150152
offset += len(members)
151153

152154
for member in members:
155+
await sleep(0)
153156
yield member
154157

155158
current += 1

pyrogram/methods/chats/get_dialogs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from typing import AsyncGenerator, Optional
2021

2122
import pyrogram
@@ -113,6 +114,7 @@ async def get_dialogs(
113114
offset_peer = await self.resolve_peer(last.chat.id)
114115

115116
for dialog in dialogs:
117+
await sleep(0)
116118
yield dialog
117119

118120
current += 1

pyrogram/methods/invite_links/get_chat_admin_invite_links.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from typing import Union, Optional, AsyncGenerator
2021

2122
import pyrogram
@@ -92,6 +93,7 @@ async def get_chat_admin_invite_links(
9293
offset_link = r.invites[-1].link
9394

9495
for i in r.invites:
96+
await sleep(0)
9597
yield types.ChatInviteLink._parse(self, i, users)
9698

9799
current += 1

pyrogram/methods/invite_links/get_chat_invite_link_joiners.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from typing import Union, Optional, AsyncGenerator
2021

2122
import pyrogram
@@ -79,6 +80,7 @@ async def get_chat_invite_link_joiners(
7980
offset_user = await self.resolve_peer(r.importers[-1].user_id)
8081

8182
for i in r.importers:
83+
await sleep(0)
8284
yield types.ChatJoiner._parse(self, i, users)
8385

8486
current += 1

pyrogram/methods/invite_links/get_chat_join_requests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from typing import Union, Optional, AsyncGenerator
2021

2122
import pyrogram
@@ -80,6 +81,7 @@ async def get_chat_join_requests(
8081
offset_user = await self.resolve_peer(r.importers[-1].user_id)
8182

8283
for i in r.importers:
84+
await sleep(0)
8385
yield types.ChatJoiner._parse(self, i, users)
8486

8587
current += 1

pyrogram/methods/messages/get_chat_history.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from datetime import datetime
2021
from typing import Union, Optional, AsyncGenerator
2122

@@ -68,7 +69,7 @@ async def get_chunk(
6869
),
6970
sleep_threshold=60
7071
)
71-
messages =await utils.parse_messages(
72+
messages = await utils.parse_messages(
7273
client,
7374
messages,
7475
is_scheduled=False,
@@ -165,6 +166,7 @@ async def get_chat_history(
165166
offset_id = messages[-1].id + (1 if reverse else 0)
166167

167168
for message in messages:
169+
await sleep(0)
168170
yield message
169171

170172
current += 1

pyrogram/methods/messages/get_discussion_replies.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from asyncio import sleep
1920
from typing import Union, Optional, AsyncGenerator
2021

2122
import pyrogram
@@ -72,12 +73,13 @@ async def get_discussion_replies(
7273

7374
users = {u.id: u for u in r.users}
7475
chats = {c.id: c for c in r.chats}
75-
messages = r.messages
76+
messages = r.messages # TODO
7677

7778
if not messages:
7879
return
7980

8081
for message in messages:
82+
await sleep(0)
8183
yield await types.Message._parse(
8284
self,
8385
message,

0 commit comments

Comments
 (0)