tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

User profile photo is not updated #3035

Closed BUITUANLINH20183784 closed 1 week ago

BUITUANLINH20183784 commented 2 months ago

Here's my situation: a user in a basicGroup chat that I'm also in has changed his profile photo. On the Telegram official app his profile photo in the chat is shown correctly. But in my app using tdlib, getUserProfilePhotos always return empty

%{
  "@client_id" => 12,
  "@type" => "chatPhotos",
  "photos" => [],
  "total_count" => 0
}

getUser and getUserFullInfo also give no profile photo. Here's the output of getUser:

%{
  "@client_id" => 12,
  "@type" => "user",
  "accent_color_id" => 0,
  "added_to_attachment_menu" => false,
  "background_custom_emoji_id" => "0",
  "emoji_status" => %{
    "@type" => "emojiStatus",
    "custom_emoji_id" => "********",
    "expiration_date" => 0
  },
  "first_name" => "********",
  "has_active_stories" => false,
  "has_unread_active_stories" => false,
  "have_access" => true,
  "id" => ********,
  "is_close_friend" => false,
  "is_contact" => false,
  "is_fake" => false,
  "is_mutual_contact" => false,
  "is_premium" => true,
  "is_scam" => false,
  "is_support" => false,
  "is_verified" => false,
  "language_code" => "",
  "last_name" => "",
  "phone_number" => "",
  "profile_accent_color_id" => -1,
  "profile_background_custom_emoji_id" => "0",
  "restriction_reason" => "",
  "restricts_new_chats" => false,
  "status" => %{
    "@type" => "userStatusRecently",
    "by_my_privacy_settings" => false
  },
  "type" => %{"@type" => "userTypeRegular"}
}

And getUserFullInfo:

%{
  "@client_id" => 12,
  "@type" => "userFullInfo",
  "bio" => %{"@type" => "formattedText", "entities" => [], "text" => ""},
  "can_be_called" => false,
  "group_in_common_count" => 4,
  "has_pinned_stories" => false,
  "has_private_calls" => true,
  "has_private_forwards" => true,
  "has_restricted_voice_and_video_note_messages" => true,
  "need_phone_number_privacy_exception" => false,
  "personal_chat_id" => 0,
  "premium_gift_options" => [],
  "set_chat_background" => false,
  "supports_video_calls" => false
}

I was wondering if this has anything to do with user cache in tdlib database? I do have use_chat_info_database option enabled.

levlam commented 1 week ago

If even after getUserFullInfo you receive no updateUserFullInfo with photos, then the user has no photo, or it isn't available to you because of privacy settings.