X Tutup
The Wayback Machine - https://web.archive.org/web/20201210054312/https://github.com/pyrogram/pyrogram/issues/536
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iter_dialogs may yield AttributeError: 'NoneType' object has no attribute 'date' #536

Open
JosXa opened this issue Nov 14, 2020 · 0 comments
Open

Comments

@JosXa
Copy link
Contributor

@JosXa JosXa commented Nov 14, 2020

Stack trace:

  File "C:\projects\botkit\botkit\agnostic\pyrogram_chat_resolver.py", line 52, in resolve_chat_by_title_regex
    async for d in self.client.iter_dialogs(limit=LIMIT):
              │    │    │      │                  └ 150
              │    │    │      └ <function IterDialogs.iter_dialogs at 0x000001DD4E289AF0>
              │    │    └ <app.clients.telegram.userclients.UserClient object at 0x000001DD540443D0>
              │    └ <botkit.agnostic.pyrogram_chat_resolver.PyrogramChatResolver object at 0x000001DD52395E20>
              └ pyrogram.types.Dialog(chat=pyrogram.types.Chat(id=855155169, type='bot', is_verified=False, is_restricted=False, is_scam=Fals...

  File "C:\git\pyrogram\pyrogram\methods\chats\iter_dialogs.py", line 81, in iter_dialogs
    offset_date = dialogs[-1].top_message.date
                  └ pyrogram.types.List([pyrogram.types.Dialog(chat=pyrogram.types.Chat(id=-1001050905835, type='supergroup', is_verified=False, ...

AttributeError: 'NoneType' object has no attribute 'date'

It seems to be an off-by-one error, as 99 dialogs have the top_message here, but the 100th does not. Maybe that's also a coincidence, but in any case in a debug session I confirmed that top_message may be unset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.
X Tutup