@@ -343,6 +343,13 @@ def __init__(
343343 def _parse_user_chat (client , user : raw .types .User ) -> "Chat" :
344344 peer_id = user .id
345345
346+ if isinstance (user , raw .types .UserEmpty ):
347+ return Chat (
348+ id = peer_id ,
349+ client = client ,
350+ _raw = user
351+ )
352+
346353 active_usernames = types .List (
347354 [
348355 types .Username ._parse (u )
@@ -382,6 +389,14 @@ def _parse_user_chat(client, user: raw.types.User) -> "Chat":
382389 def _parse_chat_chat (client , chat : raw .types .Chat ) -> "Chat" :
383390 peer_id = - chat .id
384391
392+ if isinstance (chat , raw .types .ChatEmpty ):
393+ return Chat (
394+ id = peer_id ,
395+ type = enums .ChatType .GROUP ,
396+ client = client ,
397+ _raw = chat
398+ )
399+
385400 if isinstance (chat , raw .types .ChatForbidden ):
386401 return Chat (
387402 id = peer_id ,
@@ -642,9 +657,16 @@ async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.
642657
643658 @staticmethod
644659 def _parse_chat (client , chat : Union [raw .types .Chat , raw .types .User , raw .types .Channel ]) -> "Chat" :
645- if isinstance (chat , raw .types .Chat ):
660+ if (
661+ isinstance (chat , raw .types .Chat ) or
662+ isinstance (chat , raw .types .ChatForbidden ) or
663+ isinstance (chat , raw .types .ChatEmpty )
664+ ):
646665 return Chat ._parse_chat_chat (client , chat )
647- elif isinstance (chat , raw .types .User ):
666+ elif (
667+ isinstance (chat , raw .types .User ) or
668+ isinstance (chat , raw .types .UserEmpty )
669+ ):
648670 return Chat ._parse_user_chat (client , chat )
649671 else :
650672 return Chat ._parse_channel_chat (client , chat )
0 commit comments