From 30ac6789ce741f72fdb2b0bbed87fcbe81a1bce7 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 22 Oct 2017 19:27:49 +0200 Subject: [PATCH] Change _set_connected_and_authorized condition --- telethon/telegram_bare_client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py index 318ef48e..133661d7 100644 --- a/telethon/telegram_bare_client.py +++ b/telethon/telegram_bare_client.py @@ -209,12 +209,14 @@ class TelegramBareClient: # another data center and this would raise UserMigrateError) # to also assert whether the user is logged in or not. self._user_connected = True - if _sync_updates and not _cdn and not self._authorized: + if self._authorized is None and _sync_updates and not _cdn: try: await self.sync_updates() self._set_connected_and_authorized() except UnauthorizedError: - pass + self._authorized = False + elif self._authorized: + self._set_connected_and_authorized() return True