File tree Expand file tree Collapse file tree
pyrogram/types/user_and_chats Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,16 +245,17 @@ def _parse(
245245 chats : dict ,
246246 is_chat : bool
247247 ) -> "Chat" :
248+ from_id = utils .get_raw_peer_id (message .from_id )
249+ peer_id = utils .get_raw_peer_id (message .peer_id )
250+ chat_id = (peer_id or from_id ) if is_chat else (from_id or peer_id )
251+
248252 if isinstance (message .peer_id , raw .types .PeerUser ):
249- user_id = message .peer_id .user_id if is_chat else message .from_id .user_id
250- return Chat ._parse_user_chat (client , users [user_id ])
253+ return Chat ._parse_user_chat (client , users [chat_id ])
251254
252255 if isinstance (message .peer_id , raw .types .PeerChat ):
253- chat_id = message .peer_id .chat_id if is_chat else message .from_id .chat_id
254256 return Chat ._parse_chat_chat (client , chats [chat_id ])
255257
256- channel_id = message .peer_id .channel_id if is_chat else message .from_id .channel_id
257- return Chat ._parse_channel_chat (client , chats [channel_id ])
258+ return Chat ._parse_channel_chat (client , chats [chat_id ])
258259
259260 @staticmethod
260261 def _parse_dialog (client , peer , users : dict , chats : dict ):
You can’t perform that action at this time.
0 commit comments