def get_chat(self, chat_uid: ChatID) -> 'Chat': chat_info = chat_uid.split('_') chat_type = chat_info[0] chat_attr = chat_info[1] chat = None if chat_type == 'friend': chat_uin = int(chat_attr) remark_name = self.get_friend_remark(chat_uin) chat = ChatMgr.build_efb_chat_as_private( EFBPrivateChat( uid=chat_attr, name=remark_name if remark_name else "", )) elif chat_type == 'group': chat_uin = int(chat_attr) group_info = self.get_group_info(chat_uin, no_cache=False) group_members = self.get_group_member_list(chat_uin, no_cache=False) chat = ChatMgr.build_efb_chat_as_group( EFBGroupChat(uid=f"group_{chat_uin}", name=group_info.get('GroupName', "")), group_members) elif chat_type == 'private': pass # fixme elif chat_type == 'phone': pass # fixme return chat
def get_chat(self, chat_uid: ChatID) -> 'Chat': chat_info = chat_uid.split('_') chat_type = chat_info[0] chat_attr = chat_info[1] chat = None if chat_type == 'friend': chat_uin = int(chat_attr) if not self.info_list.get('friend', None) and chat_uin in self.info_list['friend']: chat = ChatMgr.build_efb_chat_as_private(EFBPrivateChat( uid=f"friend_{chat_attr}", name=self.info_list['friend'][chat_uin].remark, alias=self.info_list['friend'][chat_uin].nickname )) else: remark_name = self.get_friend_remark(chat_uin) chat = ChatMgr.build_efb_chat_as_private(EFBPrivateChat( uid=f"friend_{chat_attr}", name=remark_name if remark_name else "", )) elif chat_type == 'group': chat_uin = int(chat_attr) group_info = self.get_group_info(chat_uin, no_cache=False) group_members = self.get_group_member_list(chat_uin, no_cache=False) chat = ChatMgr.build_efb_chat_as_group(EFBGroupChat( uid=f"group_{chat_uin}", name=group_info.get('name', "") ), group_members) elif chat_type == 'private': pass # fixme elif chat_type == 'phone': pass # fixme return chat