Fix is_user_authorized failing on log_out (closes #76)

This commit is contained in:
Lonami Exo 2017-05-11 14:11:15 +02:00
parent f64244eb44
commit d0284c2bd3

View File

@ -188,7 +188,9 @@ class TelegramClient:
def is_user_authorized(self): def is_user_authorized(self):
"""Has the user been authorized yet (code request sent and confirmed)? """Has the user been authorized yet (code request sent and confirmed)?
Note that this will NOT yield the correct result if the session was revoked by another client!""" Note that this will NOT yield the correct result if the session was revoked by another client!"""
return self.session.user is not None if self.session and self.session.user is not None:
return True
return False
def send_code_request(self, phone_number): def send_code_request(self, phone_number):
"""Sends a code request to the specified phone number""" """Sends a code request to the specified phone number"""