Fix global searching with from_user or filter

This commit is contained in:
penn5 2020-04-29 17:13:30 +01:00 committed by GitHub
parent 0f1f655e5d
commit a710caf86e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,7 @@ class _MessagesIter(RequestIter):
filter = types.InputMessagesFilterEmpty() filter = types.InputMessagesFilterEmpty()
# Telegram completely ignores `from_id` in private chats # Telegram completely ignores `from_id` in private chats
if self.entity:
ty = helpers._entity_type(self.entity) ty = helpers._entity_type(self.entity)
if ty == helpers._EntityType.USER: if ty == helpers._EntityType.USER:
# Don't bother sending `from_user` (it's ignored anyway), # Don't bother sending `from_user` (it's ignored anyway),
@ -95,6 +96,8 @@ class _MessagesIter(RequestIter):
# Do send `from_user` to do the filtering server-side, # Do send `from_user` to do the filtering server-side,
# and set `from_id` to None to avoid checking it locally. # and set `from_id` to None to avoid checking it locally.
self.from_id = None self.from_id = None
else:
self.from_id = None
self.request = functions.messages.SearchRequest( self.request = functions.messages.SearchRequest(
peer=self.entity, peer=self.entity,