Bugfixes in chat.py (#411)

- Fixed this bug: https://t.me/pyrogramchat/169553 (which was caused because pyrogram trying to parse linked_chat even if it was None).

- Fixed another related bug (which was caused because pyrogram trying to get linked_chat_id even with basic groups causing an AttributeError).
This commit is contained in:
SuperCz1 2020-05-23 14:52:14 +02:00 committed by GitHub
parent d5a18eb063
commit d93b9275f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -252,6 +252,7 @@ class Chat(Object):
if full_chat.id == c.id: if full_chat.id == c.id:
chat = c chat = c
if isinstance(chat_full, types.ChannelFull):
if full_chat.linked_chat_id == c.id: if full_chat.linked_chat_id == c.id:
linked_chat = c linked_chat = c
@ -268,6 +269,7 @@ class Chat(Object):
# TODO: Add StickerSet type # TODO: Add StickerSet type
parsed_chat.can_set_sticker_set = full_chat.can_set_stickers parsed_chat.can_set_sticker_set = full_chat.can_set_stickers
parsed_chat.sticker_set_name = getattr(full_chat.stickerset, "short_name", None) parsed_chat.sticker_set_name = getattr(full_chat.stickerset, "short_name", None)
if linked_chat:
parsed_chat.linked_chat = Chat._parse_channel_chat(client, linked_chat) parsed_chat.linked_chat = Chat._parse_channel_chat(client, linked_chat)
if full_chat.pinned_msg_id: if full_chat.pinned_msg_id: