From 7325718f0ee3d62893b50dd1d6f915e69363c4e7 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 13 Sep 2023 17:35:15 +0200 Subject: [PATCH] Fix date empty when getting difference --- telethon/_updates/messagebox.py | 9 +++++---- telethon/version.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/telethon/_updates/messagebox.py b/telethon/_updates/messagebox.py index ac961bf2..0c0d008b 100644 --- a/telethon/_updates/messagebox.py +++ b/telethon/_updates/messagebox.py @@ -175,7 +175,7 @@ class MessageBox: map: dict = _sentinel, # entry -> state # Additional fields beyond PTS needed by `ENTRY_ACCOUNT`. - date: datetime.datetime = epoch(), + date: datetime.datetime = epoch() + datetime.timedelta(seconds=1), seq: int = NO_SEQ, # Holds the entry with the closest deadline (optimization to avoid recalculating the minimum deadline). @@ -478,7 +478,8 @@ class MessageBox: if any_pts_applied[0]: if __debug__: self._trace('Updating seq as local pts was updated too') - self.date = date + if date != epoch(): + self.date = date if seq != NO_SEQ: self.seq = seq @@ -689,7 +690,7 @@ class MessageBox: updates=diff.other_updates, users=diff.users, chats=diff.chats, - date=epoch() + datetime.timedelta(seconds=1), + date=epoch(), seq=NO_SEQ, # this way date is not used ), chat_hashes, updates) @@ -798,7 +799,7 @@ class MessageBox: updates=diff.other_updates, users=diff.users, chats=diff.chats, - date=epoch() + datetime.timedelta(seconds=1), + date=epoch(), seq=NO_SEQ, # this way date is not used ), chat_hashes, updates) diff --git a/telethon/version.py b/telethon/version.py index 57772768..832c0ac0 100644 --- a/telethon/version.py +++ b/telethon/version.py @@ -1,3 +1,3 @@ # Versions should comply with PEP440. # This line is parsed in setup.py: -__version__ = '1.30.2' +__version__ = '1.30.3'