mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 15:34:52 +00:00
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:
parent
74699d8bdf
commit
b412622bc7
1 changed files with 11 additions and 2 deletions
|
|
@ -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 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
|
photos = (current + extra) if current[0].file_id != extra[0].file_id else extra
|
||||||
else:
|
else:
|
||||||
photos = extra
|
photos = extra
|
||||||
|
|
@ -111,6 +117,9 @@ class GetChatPhotos:
|
||||||
|
|
||||||
current = 0
|
current = 0
|
||||||
|
|
||||||
|
if len(photos) == 0 or (len(photos) == 1 and not isinstance(photos[0], types.Photo)):
|
||||||
|
return
|
||||||
|
|
||||||
for photo in photos:
|
for photo in photos:
|
||||||
yield photo
|
yield photo
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue