Update UserFull according to the new schema

This commit is contained in:
Dan 2021-12-08 07:43:02 +01:00
parent 439935b401
commit 8a08dcb92a

View File

@ -266,15 +266,15 @@ class Chat(Object):
return Chat._parse_channel_chat(client, chats[peer.channel_id]) return Chat._parse_channel_chat(client, chats[peer.channel_id])
@staticmethod @staticmethod
async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.types.UserFull]) -> "Chat": async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.types.users.UserFull]) -> "Chat":
if isinstance(chat_full, raw.types.UserFull): if isinstance(chat_full, raw.types.users.UserFull):
parsed_chat = Chat._parse_user_chat(client, chat_full.user) parsed_chat = Chat._parse_user_chat(client, chat_full.users[0])
parsed_chat.bio = chat_full.about parsed_chat.bio = chat_full.full_user.about
if chat_full.pinned_msg_id: if chat_full.full_user.pinned_msg_id:
parsed_chat.pinned_message = await client.get_messages( parsed_chat.pinned_message = await client.get_messages(
parsed_chat.id, parsed_chat.id,
message_ids=chat_full.pinned_msg_id message_ids=chat_full.full_user.pinned_msg_id
) )
else: else:
full_chat = chat_full.full_chat full_chat = chat_full.full_chat