Skip to content

Commit

Permalink
Temporary fix for an edge case
Browse files Browse the repository at this point in the history
Closes #80
  • Loading branch information
SpEcHiDe committed Aug 30, 2024
1 parent 635b268 commit bbc8bb8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyrogram/methods/users/get_chat_photos.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ async def get_chat_photos(
current = 0

for photo in photos:
if not photo:
continue

yield photo

current += 1
Expand Down

2 comments on commit bbc8bb8

@KurimuzonAkuma
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which case?!

@SpEcHiDe
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n is pyrogram.Client of an user account. There was no issues with bot accounts.

> print(await n.get_chat_photos_count("@thanktg"))

>> 12
> async for photo in n.get_chat_photos("thanktg", limit=2):
  print(photo)

>> Traceback (most recent call last):
  File "/bot/eval.py", line 326, in _run_coro
    ret = loop.run_until_complete(task)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "<string>", line 3, in __aexec
  File "/venv/lib/python3.9/site-packages/pyrogram/methods/users/get_chat_photos.py", line 101, in get_chat_photos
    photos = (current + extra) if current[0].file_id != extra[0].file_id else extra
AttributeError: 'list' object has no attribute 'file_id'

Please sign in to comment.