From 8f2e4f03b763a7edd4e107f731aa3fb5fc74fda4 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 30 Aug 2020 13:18:10 +0200 Subject: [PATCH] Fix access to invalid attributes when parsing a chat dc_id --- pyrogram/types/user_and_chats/chat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrogram/types/user_and_chats/chat.py b/pyrogram/types/user_and_chats/chat.py index 8ae130c6..44d6e156 100644 --- a/pyrogram/types/user_and_chats/chat.py +++ b/pyrogram/types/user_and_chats/chat.py @@ -180,7 +180,7 @@ class Chat(Object): last_name=user.last_name, photo=types.ChatPhoto._parse(client, user.photo, peer_id, user.access_hash), restrictions=types.List([types.Restriction._parse(r) for r in user.restriction_reason]) or None, - dc_id=getattr(user.photo, "dc_id", None), + dc_id=getattr(getattr(user, "photo", None), "dc_id", None), client=client ) @@ -196,7 +196,7 @@ class Chat(Object): photo=types.ChatPhoto._parse(client, getattr(chat, "photo", None), peer_id, 0), permissions=types.ChatPermissions._parse(getattr(chat, "default_banned_rights", None)), members_count=getattr(chat, "participants_count", None), - dc_id=getattr(chat.photo, "dc_id", None), + dc_id=getattr(getattr(chat, "photo", None), "dc_id", None), client=client ) @@ -218,7 +218,7 @@ class Chat(Object): restrictions=types.List([types.Restriction._parse(r) for r in restriction_reason]) or None, permissions=types.ChatPermissions._parse(getattr(channel, "default_banned_rights", None)), members_count=getattr(channel, "participants_count", None), - dc_id=getattr(channel.photo, "dc_id", None), + dc_id=getattr(getattr(channel, "photo", None), "dc_id", None), client=client )