From f9b76e45f2944952e45f107ba1f89ef6ff4df7d8 Mon Sep 17 00:00:00 2001 From: Maxim Mikityanskiy Date: Thu, 18 Oct 2018 23:28:44 +0300 Subject: [PATCH] Add a workaround to make 'me' work again --- track/__main__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/track/__main__.py b/track/__main__.py index 5860a29..3977c33 100644 --- a/track/__main__.py +++ b/track/__main__.py @@ -49,7 +49,13 @@ client.start() online = None last_offline = None while True: - contact = client.get_entity(contact_id) + if contact_id in ['me', 'self']: + # Workaround for the regression in Telethon that breaks get_entity('me'): + # https://github.com/LonamiWebs/Telethon/issues/1024 + contact = client.get_me() + else: + contact = client.get_entity(contact_id) + if isinstance(contact.status, UserStatusOffline): if online != False: online = False