Fix iter_messages could get stuck on global search

Found thanks to #920. Issue probably introduced in b6d8311.
This commit is contained in:
Lonami Exo 2022-10-18 16:00:18 +02:00
parent ef4f9a962c
commit b3266fabd8

View File

@ -204,6 +204,10 @@ class _MessagesIter(RequestIter):
message._finish_init(self.client, entities, self.entity)
self.buffer.append(message)
# Not a slice (using offset would return the same, with e.g. SearchGlobal).
if isinstance(r, types.messages.Messages):
return True
# Some channels are "buggy" and may return less messages than
# requested (apparently, the messages excluded are, for example,
# "not displayable due to local laws").