mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Fix messages.search accidentally being used over getHistory
Introduced by 668dcd52ca
(this commit
did change a lot more than it should have); the condition for search
was never updated to account for the non-None value.
Closes #1693.
This commit is contained in:
parent
acb066ad2e
commit
23041f398b
|
@ -70,6 +70,8 @@ class _MessagesIter(RequestIter):
|
|||
|
||||
if filter is None:
|
||||
filter = types.InputMessagesFilterEmpty()
|
||||
else:
|
||||
filter = filter() if isinstance(filter, type) else filter
|
||||
|
||||
if not self.entity:
|
||||
self.request = functions.messages.SearchGlobalRequest(
|
||||
|
@ -94,7 +96,7 @@ class _MessagesIter(RequestIter):
|
|||
min_id=0,
|
||||
hash=0
|
||||
)
|
||||
elif search is not None or filter or from_user:
|
||||
elif search is not None or not isinstance(filter, types.InputMessagesFilterEmpty) or from_user:
|
||||
# Telegram completely ignores `from_id` in private chats
|
||||
ty = helpers._entity_type(self.entity)
|
||||
if ty == helpers._EntityType.USER:
|
||||
|
@ -109,7 +111,7 @@ class _MessagesIter(RequestIter):
|
|||
self.request = functions.messages.SearchRequest(
|
||||
peer=self.entity,
|
||||
q=search or '',
|
||||
filter=filter() if isinstance(filter, type) else filter,
|
||||
filter=filter,
|
||||
min_date=None,
|
||||
max_date=offset_date,
|
||||
offset_id=offset_id,
|
||||
|
|
Loading…
Reference in New Issue
Block a user