From 6c73538bd412717143b7fad459f529f81807b4fa Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 23 Jan 2018 11:39:43 +0100 Subject: [PATCH] Fix time_offset not being used at all after BadMsgNotification Telegram would refuse to reply any further unless the message ID had the correct time (causing some behaviour like .connect() never connecting, due to the first request being sent always failing). The fix was to use time_offset when calculating the message ID, while this was right, it wasn't in use. --- telethon/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/session.py b/telethon/session.py index 21c0e105..5657f339 100644 --- a/telethon/session.py +++ b/telethon/session.py @@ -311,7 +311,7 @@ class Session: now = time.time() nanoseconds = int((now - int(now)) * 1e+9) # "message identifiers are divisible by 4" - new_msg_id = (int(now) << 32) | (nanoseconds << 2) + new_msg_id = ((int(now) + self.time_offset) << 32) | (nanoseconds << 2) with self._msg_id_lock: if self._last_msg_id >= new_msg_id: