Change _set_connected_and_authorized condition

This commit is contained in:
Lonami Exo 2017-10-22 19:27:49 +02:00
parent 1a0d5e75bf
commit 30ac6789ce

View File

@ -209,12 +209,14 @@ class TelegramBareClient:
# another data center and this would raise UserMigrateError) # another data center and this would raise UserMigrateError)
# to also assert whether the user is logged in or not. # to also assert whether the user is logged in or not.
self._user_connected = True 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: try:
await self.sync_updates() await self.sync_updates()
self._set_connected_and_authorized() self._set_connected_and_authorized()
except UnauthorizedError: except UnauthorizedError:
pass self._authorized = False
elif self._authorized:
self._set_connected_and_authorized()
return True return True