From 2836dcb3a9c0b290d0b29055951653d231a8789e Mon Sep 17 00:00:00 2001 From: h Date: Wed, 14 Oct 2026 05:09:38 +0200 Subject: [PATCH] fix(backend): stale avatar is refetched again under kurigram 2.2.26, profile photos come as chat photos --- .../src/userbot/modules/jobs/handlers/fetch_avatar.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/backend/src/userbot/modules/jobs/handlers/fetch_avatar.py b/backend/src/userbot/modules/jobs/handlers/fetch_avatar.py index 816edaf..8177e11 100644 --- a/backend/src/userbot/modules/jobs/handlers/fetch_avatar.py +++ b/backend/src/userbot/modules/jobs/handlers/fetch_avatar.py @@ -1,6 +1,6 @@ from pyrogram import Client from pyrogram.errors import FileIdInvalid, FileReferenceExpired, FileReferenceInvalid -from pyrogram.types import Photo +from pyrogram.types import ChatPhoto from userbot.modules.avatars.repository import get_avatar_file, mark_avatar_downloaded from userbot.modules.download import download_bytes @@ -15,12 +15,9 @@ async def _fresh_file_id(client: Client, owner_id: int, unique_id: str) -> str | photo = chat.photo if chat else None if photo and photo.big_photo_unique_id == unique_id: return photo.big_file_id - photos = client.get_chat_photos(owner_id) - if photos is None: - return None - async for item in photos: - if isinstance(item, Photo) and item.file_unique_id == unique_id: - return item.file_id + async for item in client.get_chat_photos(owner_id): + if isinstance(item, ChatPhoto) and item.big_photo_unique_id == unique_id: + return item.big_file_id return None