Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profile photo to response #31

Open
xstu25 opened this issue May 16, 2024 · 1 comment
Open

Add profile photo to response #31

xstu25 opened this issue May 16, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers nice to have An issue that is not a priority for us, but for which we welcome pull requests

Comments

@xstu25
Copy link

xstu25 commented May 16, 2024

Hello. Thanks a lot for your amazing script.

Is there a way to access to Telegram profile picture of the account found ?

Thanks for reply.

@GalenReich GalenReich added the enhancement New feature or request label May 16, 2024
@GalenReich GalenReich changed the title Thanks ! - picture access ? Add profile photo to response May 16, 2024
@GalenReich GalenReich added good first issue Good for newcomers nice to have An issue that is not a priority for us, but for which we welcome pull requests labels May 16, 2024
@GalenReich
Copy link
Contributor

This is a good idea. It is very possible as Telethon returns the UserProfilePhoto in its existing response. There is also the download_profile_photo method that would be suitable for this.

The behaviour should be accessed through an optional flag (that defaults to not downloading photos), something like:

telegram-phone-number-checker --download-profile-photos --phone-numbers +1234567890

The changes would likely need to be made in this block:

# Attempt to remove the contact from the address book.
# The response from DeleteContactsRequest contains more information than from ImportContactsRequest
updates_response: types.Updates = await client(
functions.contacts.DeleteContactsRequest(id=[users[0].get("id")])
)
user = updates_response.users[0]
# getting more information about the user
result.update(
{
"id": user.id,
"username": user.username,
"usernames": user.usernames,
"first_name": user.first_name,
"last_name": user.last_name,
"fake": user.fake,
"verified": user.verified,
"premium": user.premium,
"mutual_contact": user.mutual_contact,
"bot": user.bot,
"bot_chat_history": user.bot_chat_history,
"restricted": user.restricted,
"restriction_reason": user.restriction_reason,
"user_was_online": get_human_readable_user_status(user.status),
"phone": user.phone,
}
)

We would welcome a PR to implement this! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers nice to have An issue that is not a priority for us, but for which we welcome pull requests
Projects
None yet
Development

No branches or pull requests

2 participants