Fix access to invalid attributes when parsing a chat dc_id
This commit is contained in:
parent
b39f2c44b8
commit
8f2e4f03b7
@ -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
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user