diff options
| author | Rapptz <[email protected]> | 2015-12-16 22:44:45 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-12-16 22:44:45 -0500 |
| commit | f78e3c9f0b862613fa6f3372fff682ebaf096489 (patch) | |
| tree | 4aba00279f98ad83b72faadd4f4238c024d3585d | |
| parent | Remove the non-classmethod attributes in Permissions. (diff) | |
| download | discord.py-f78e3c9f0b862613fa6f3372fff682ebaf096489.tar.xz discord.py-f78e3c9f0b862613fa6f3372fff682ebaf096489.zip | |
Fix Client.logs_from failing if no more messages are found.
| -rw-r--r-- | discord/client.py | 9 |
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) |