mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-05 21:03:10 +03:00
Workaround #1124 (Telegram ignoring offset_date)
This commit is contained in:
parent
7c48857d0c
commit
f6c4ab6f41
|
@ -99,6 +99,18 @@ class _MessagesIter(RequestIter):
|
||||||
hash=0,
|
hash=0,
|
||||||
from_id=from_user
|
from_id=from_user
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Workaround issue #1124 until a better solution is found.
|
||||||
|
# Telegram seemingly ignores `max_date` if `filter` (and
|
||||||
|
# nothing else) is specified, so we have to rely on doing
|
||||||
|
# a first request to offset from the ID instead.
|
||||||
|
#
|
||||||
|
# Even better, using `filter` and `from_id` seems to always
|
||||||
|
# trigger `RPC_CALL_FAIL` which is "internal issues"...
|
||||||
|
if filter and offset_date and not search and not offset_id:
|
||||||
|
async for m in self.client.iter_messages(
|
||||||
|
self.entity, 1, offset_date=offset_date):
|
||||||
|
self.request.offset_id = m.id + 1
|
||||||
else:
|
else:
|
||||||
self.request = functions.messages.GetHistoryRequest(
|
self.request = functions.messages.GetHistoryRequest(
|
||||||
peer=self.entity,
|
peer=self.entity,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user