mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 01:46:35 +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,
|
||||
InputMessagesFilterEmpty, UpdatesCombined
|
||||
)
|
||||
from .tl.types.messages import DialogsSlice
|
||||
from .tl.types.messages import DialogsSlice, MessagesNotModified
|
||||
from .tl.types.account import PasswordInputSettings, NoPassword
|
||||
from .tl import custom
|
||||
from .utils import Default
|
||||
|
@ -1220,6 +1220,9 @@ class TelegramClient(TelegramBareClient):
|
|||
return
|
||||
# No messages, but we still need to know the total message count
|
||||
result = self(request)
|
||||
if isinstance(result, MessagesNotModified):
|
||||
_total[0] = result.count
|
||||
else:
|
||||
_total[0] = getattr(result, 'count', len(result.messages))
|
||||
return
|
||||
|
||||
|
@ -1279,6 +1282,10 @@ class TelegramClient(TelegramBareClient):
|
|||
else:
|
||||
r = self(messages.GetMessagesRequest(ids))
|
||||
|
||||
if isinstance(r, MessagesNotModified):
|
||||
for _ in ids:
|
||||
yield None
|
||||
|
||||
entities = {utils.get_peer_id(x): x
|
||||
for x in itertools.chain(r.users, r.chats)}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user