D
D
del4pp2020-05-24 12:57:14
Python
del4pp, 2020-05-24 12:57:14

Telethon Delete from contacts by phone number, how?

Hello.
There is a list of phone numbers that need to be removed from contacts via Telethon . I
use this code for this:

def delete_contact():
    with open('phone.txt', 'rt') as f:
        phone_list = f.read().split('\n')
    with TelegramClient(name, api_id, api_hash) as client:
        result = client(functions.contacts.DeleteByPhonesRequest(
            phones=phone_list
        ))
        print(result)


The code returns True as it should, but the numbers are not removed from the contacts.
Who will tell you how to fix it?

(passed a sheet with numbers, and each number separately, does not work)

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