aboutsummaryrefslogtreecommitdiff
path: root/discord/iterators.py
diff options
context:
space:
mode:
authorNadir Chowdhury <[email protected]>2021-02-25 02:26:51 +0000
committerGitHub <[email protected]>2021-02-24 21:26:51 -0500
commit63ec23bac24ab62633bdb8fd19b93ecd3fddba7c (patch)
tree14ad9433dddf4c056c292a07e2c0e74b79942cdd /discord/iterators.py
parentFix NameError with invoked_parents (diff)
downloaddiscord.py-63ec23bac24ab62633bdb8fd19b93ecd3fddba7c.tar.xz
discord.py-63ec23bac24ab62633bdb8fd19b93ecd3fddba7c.zip
Code optimisations and refactoring via Sourcery
Diffstat (limited to 'discord/iterators.py')
-rw-r--r--discord/iterators.py28
1 files changed, 8 insertions, 20 deletions
diff --git a/discord/iterators.py b/discord/iterators.py
index a9575d49..d18437ca 100644
--- a/discord/iterators.py
+++ b/discord/iterators.py
@@ -291,13 +291,10 @@ class HistoryIterator(_AsyncIterator):
def _get_retrieve(self):
l = self.limit
- if l is None:
+ if l is None or l > 100:
r = 100
- elif l <= 100:
- r = l
else:
- r = 100
-
+ r = l
self.retrieve = r
return r > 0
@@ -447,13 +444,10 @@ class AuditLogIterator(_AsyncIterator):
def _get_retrieve(self):
l = self.limit
- if l is None:
+ if l is None or l > 100:
r = 100
- elif l <= 100:
- r = l
else:
- r = 100
-
+ r = l
self.retrieve = r
return r > 0
@@ -547,13 +541,10 @@ class GuildIterator(_AsyncIterator):
def _get_retrieve(self):
l = self.limit
- if l is None:
+ if l is None or l > 100:
r = 100
- elif l <= 100:
- r = l
else:
- r = 100
-
+ r = l
self.retrieve = r
return r > 0
@@ -636,13 +627,10 @@ class MemberIterator(_AsyncIterator):
def _get_retrieve(self):
l = self.limit
- if l is None:
+ if l is None or l > 1000:
r = 1000
- elif l <= 1000:
- r = l
else:
- r = 1000
-
+ r = l
self.retrieve = r
return r > 0