Answer the question
In order to leave comments, you need to log in
How to get a link to a Telegram user's profile photo?
How to get a link to a Telegram user's profile photo? Tried with getUserProfilePhotos method, but I get "400. Description: Bad Request: user not found" error. As an argument, I pass the IDs of users who have written to the bot at least once. Are there any restrictions on this method? Is it possible to get the profile photo of only certain users? I am using the pyTelegramBotAPI library.
Answer the question
In order to leave comments, you need to log in
@bot.message_handler(commands=["self_photo"])
def user_photo(message):
photo = bot.get_user_profile_photos(message.from_user.id)
bot.send_photo(message.chat.id, photo.photos[0][2].file_id)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question