Visitar URL original
Fix Attribute error when recieved ChatForbidden by MrMissx · Pull Request #722 · pyrogram/pyrogram · GitHub
The Wayback Machine - https://web.archive.org/web/20240130020234/https://github.com/pyrogram/pyrogram/pull/722
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

Fix Attribute error when recieved ChatForbidden #722

Closed
wants to merge 1 commit into from
Closed

Fix Attribute error when recieved ChatForbidden #722

wants to merge 1 commit into from

Conversation

MrMissx
Copy link
Contributor

@MrMissx MrMissx commented Jul 21, 2021 •

There were a random exception raised when client kicked from a private group.
Turns out that the recieved type was a raw.types.ChatForbidden not a raw.types.Chat.
Causing _parse_chat() calling _parse_channel_chat().

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 191, in handler_worker
    await parser(update, users, chats)
  File "/usr/local/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 107, in chat_member_updated_parser
    return pyrogram.types.ChatMemberUpdated._parse(self.client, update, users, chats), ChatMemberUpdatedHandler
  File "/usr/local/lib/python3.9/site-packages/pyrogram/types/user_and_chats/chat_member_updated.py", line 94, in _parse
    chat=types.Chat._parse_chat(client, chats[chat_id]),
  File "/usr/local/lib/python3.9/site-packages/pyrogram/types/user_and_chats/chat.py", line 317, in _parse_chat
    return Chat._parse_channel_chat(client, chat)
  File "/usr/local/lib/python3.9/site-packages/pyrogram/types/user_and_chats/chat.py", line 224, in _parse_channel_chat
    type="supergroup" if channel.megagroup else "channel",
AttributeError: 'ChatForbidden' object has no attribute 'megagroup'

@delivrance
Copy link
Member

9b28a12

@delivrance delivrance closed this Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants