aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-12-16 22:44:45 -0500
committerRapptz <[email protected]>2015-12-16 22:44:45 -0500
commitf78e3c9f0b862613fa6f3372fff682ebaf096489 (patch)
tree4aba00279f98ad83b72faadd4f4238c024d3585d
parentRemove the non-classmethod attributes in Permissions. (diff)
downloaddiscord.py-f78e3c9f0b862613fa6f3372fff682ebaf096489.tar.xz
discord.py-f78e3c9f0b862613fa6f3372fff682ebaf096489.zip
Fix Client.logs_from failing if no more messages are found.
-rw-r--r--discord/client.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/discord/client.py b/discord/client.py
index 21fe412e..64ceb8c9 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -1110,9 +1110,12 @@ class Client:
while limit > 0:
retrieve = limit if limit <= 100 else 100
data = yield from self._logs_from(channel, retrieve, before, after)
- limit -= retrieve
- result.extend(data)
- before = Object(id=data[-1]['id'])
+ if len(data):
+ limit -= retrieve
+ result.extend(data)
+ before = Object(id=data[-1]['id'])
+ else:
+ break
return generator(result)