Skip to content

Commit

Permalink
Update iterators.py
Browse files Browse the repository at this point in the history
Signed-off-by: Lala Sabathil <[email protected]>
  • Loading branch information
Lulalaby committed Jul 4, 2024
1 parent 456c1d4 commit 9e0cb93
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions discord/iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,9 @@ def __init__(
self.after = after or OLDEST_OBJECT
self._users = {}
self._state = guild._state

self._filter = None # entry dict -> bool

self.entries = asyncio.Queue()

self._strategy = self._strategy_exec

async def _strategy_exec(self, retrieve):
async def _retrieve_auditlogs(self, retrieve):
before = self.before.id if self.before else None
after = self.after.id if self.after else None
data: AuditLogPayload = await self.request(
Expand Down Expand Up @@ -545,13 +540,10 @@ async def _fill(self):
from .user import User

if self._get_retrieve():
users, data = await self._strategy(self.retrieve)
users, data = await self._retrieve_auditlogs(self.retrieve)
if len(data) < 100:
self.limit = 0 # terminate the infinite loop

if self._filter:
data = filter(self._filter, data)

for user in users:
u = User(data=user, state=self._state)
self._users[u.id] = u
Expand Down

0 comments on commit 9e0cb93

Please sign in to comment.