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

Unable to retrieve user profile photos using ProfilePhotosOf method #755

Open
nkbmdev opened this issue Oct 31, 2024 · 0 comments
Open

Unable to retrieve user profile photos using ProfilePhotosOf method #755

nkbmdev opened this issue Oct 31, 2024 · 0 comments

Comments

@nkbmdev
Copy link

nkbmdev commented Oct 31, 2024

I am trying to retrieve a user’s profile photo using the Telebot library, but the ProfilePhotosOf method always returns an empty array. I’ve tried different approaches, but the result remains the same:

  1. WebApp InitData - returns empty photo_url.
  2. ProfilePhotosOf method - always returns an empty array, regardless of the account. The user has set profile photo visibility to public, and their profile photo displays correctly in other bots.

Code Example:

const BotToken = "YOUR_TOKEN"
const UserID int64 = 0    // telegram users id

func Example_GetUsersProfilePhotos() {
    pref := telebot.Settings{
        Token:  BotToken,
        Poller: &telebot.LongPoller{Timeout: 10 * time.Second},
    }
    bot, err := telebot.NewBot(pref)
    if err != nil {
        fmt.Println(err)
    }

    user := telebot.User{ID: int64(UserID)}
    photos, err := bot.ProfilePhotosOf(&user)
    if err != nil {
        fmt.Println("Error retrieving photos")
        return
    }

    fmt.Println(photos) // always returns an empty array
}

Question:

Why does the ProfilePhotosOf method always return an empty array? Am I missing something in the settings or initialization? Any advice or ideas on how to solve this issue would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant