Fix Client.logs_from failing if no more messages are found.

This commit is contained in:
Rapptz committed 2015-12-16 22:44:45 -05:00
1 parent 434fc5c79e
commit f78e3c9f0b
1 file changed
+6 -3
+6 -3
View File
@@ -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)