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