pyrofork: Fix get_chat_photo incase photo not found and limit param is enabled

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2024-09-02 20:31:50 +07:00
parent 74699d8bdf
commit b412622bc7
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -96,10 +96,16 @@ class GetChatPhotos:
)
)
extra = [message.new_chat_photo for message in r]
extra = [message.new_chat_photo for message in r] if r else []
if extra:
if current:
if (
current
and
len(current) > 0
and
isinstance(current[0], types.Photo)
):
photos = (current + extra) if current[0].file_id != extra[0].file_id else extra
else:
photos = extra
@ -111,6 +117,9 @@ class GetChatPhotos:
current = 0
if len(photos) == 0 or (len(photos) == 1 and not isinstance(photos[0], types.Photo)):
return
for photo in photos:
yield photo