Unable to retrieve user profile photos using ProfilePhotosOf method
Opened this issue · 0 comments
nk-bm commented
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:
- WebApp InitData - returns empty photo_url.
- 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.