R
R
Rotyin2022-01-15 10:51:47
Python
Rotyin, 2022-01-15 10:51:47

How to check if an account with the telethon library is banned?

this_client = TelegramClient(phone_number, api_id, api_hash)
        this_client.connect() 
        if not this_client.is_user_authorized():
            try:
                this_client.send_code_request(phone_number)
            except telethon.errors.rpc_error_list.PhoneNumberBannedError:
                print("Phone number is banned.")
                this_client.disconnect()

Here is the code that doesn't work. Are there other possibilities?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question