diff --git a/pyproject.toml b/pyproject.toml index c0dc525..77a9dad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "telegram-phone-number-checker" -version = "1.0.6" +version = "1.0.7" description = "Check if phone numbers are connected to Telegram accounts." authors = ["Bellingcat"] license = "MIT" diff --git a/telegram_phone_number_checker/main.py b/telegram_phone_number_checker/main.py index 36780d6..3fc74b4 100644 --- a/telegram_phone_number_checker/main.py +++ b/telegram_phone_number_checker/main.py @@ -23,9 +23,10 @@ def get_names(client, phone_number): if number_of_matches == 0: result.update({"error": f'No response, the phone number is not on Telegram or has blocked contact adding.'}) elif number_of_matches == 1: - user = users[0] # Attempt to remove the contact from the address book - client(functions.contacts.DeleteContactsRequest(id=[user.get('id')])) + # The response from DeleteContactsRequest contains more information than from ImportContactsRequest + del_user = client(functions.contacts.DeleteContactsRequest(id=[users[0].get('id')])) + user = del_user.to_dict().get('users')[0] # getting more information about the user result.update({ "id": user.get('id'),