I am trying to log the user into the account using the telegram bot API, and I can't find a way to check if the client instance has access to an account...
this is my instance:
client = TelegramClient(client_name, API_ID, API_HASH)
by using client.start()
it detects if the user is logged in or not, so i must have access to that too...
You need to use get_me()
: it will return the current logged in user or None
if there isn't one.
client = TelegramClient(client_name, API_ID, API_HASH)
if (await client.get_me()):
# client has an user logged in
else:
# client hasn't an user logged in
Also, if you take a look at the source code, you'll see that start()
is doing the same.