mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-30 05:13:45 +03:00
Handle MessagesNotModified on iter_messages
This commit is contained in:
parent
8d7c7a19c0
commit
81c61a0a2e
|
@ -91,7 +91,7 @@ from .tl.types import (
|
||||||
ChannelParticipantsBanned, ChannelParticipantsKicked,
|
ChannelParticipantsBanned, ChannelParticipantsKicked,
|
||||||
InputMessagesFilterEmpty, UpdatesCombined
|
InputMessagesFilterEmpty, UpdatesCombined
|
||||||
)
|
)
|
||||||
from .tl.types.messages import DialogsSlice
|
from .tl.types.messages import DialogsSlice, MessagesNotModified
|
||||||
from .tl.types.account import PasswordInputSettings, NoPassword
|
from .tl.types.account import PasswordInputSettings, NoPassword
|
||||||
from .tl import custom
|
from .tl import custom
|
||||||
from .utils import Default
|
from .utils import Default
|
||||||
|
@ -1220,6 +1220,9 @@ class TelegramClient(TelegramBareClient):
|
||||||
return
|
return
|
||||||
# No messages, but we still need to know the total message count
|
# No messages, but we still need to know the total message count
|
||||||
result = self(request)
|
result = self(request)
|
||||||
|
if isinstance(result, MessagesNotModified):
|
||||||
|
_total[0] = result.count
|
||||||
|
else:
|
||||||
_total[0] = getattr(result, 'count', len(result.messages))
|
_total[0] = getattr(result, 'count', len(result.messages))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1279,6 +1282,10 @@ class TelegramClient(TelegramBareClient):
|
||||||
else:
|
else:
|
||||||
r = self(messages.GetMessagesRequest(ids))
|
r = self(messages.GetMessagesRequest(ids))
|
||||||
|
|
||||||
|
if isinstance(r, MessagesNotModified):
|
||||||
|
for _ in ids:
|
||||||
|
yield None
|
||||||
|
|
||||||
entities = {utils.get_peer_id(x): x
|
entities = {utils.get_peer_id(x): x
|
||||||
for x in itertools.chain(r.users, r.chats)}
|
for x in itertools.chain(r.users, r.chats)}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user