mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-13 17:42:29 +03:00
Add channel state only if channel exist in entities (Correcting the situation when the channel was not written to entities, because it came in the form of min, and state was written and the next time it was turned on with the catch_up parameter, the script did not run)
This commit is contained in:
parent
a7e8160d72
commit
b263536ab8
|
@ -664,8 +664,10 @@ class TelegramBaseClient(abc.ABC):
|
|||
ss, cs = self._message_box.session_state()
|
||||
self.session.set_update_state(0, types.updates.State(**ss, unread_count=0))
|
||||
now = datetime.datetime.now() # any datetime works; channels don't need it
|
||||
entities_ids = [e.id for e in entities]
|
||||
for channel_id, pts in cs.items():
|
||||
self.session.set_update_state(channel_id, types.updates.State(pts, 0, now, 0, unread_count=0))
|
||||
if channel_id in entities_ids:
|
||||
self.session.set_update_state(channel_id, types.updates.State(pts, 0, now, 0, unread_count=0))
|
||||
|
||||
async def _disconnect_coro(self: 'TelegramClient'):
|
||||
if self.session is None:
|
||||
|
|
Loading…
Reference in New Issue
Block a user