分开个人好友和群好友

This commit is contained in:
liuwei
2025-05-26 16:43:31 +08:00
parent da0d95d635
commit 6adef5277b
2 changed files with 20 additions and 14 deletions
+9 -6
View File
@@ -183,8 +183,9 @@ class Robot:
# 登录成功后加载联系人信息
self.allContacts = self.get_all_contacts()
friends = await self.ipad_bot.get_contract_list()
self.head_images = self.get_all_head_images()
self.contact_manager.set_contacts(self.allContacts, self.head_images)
self.contact_manager.set_contacts(self.allContacts, friends, self.head_images)
self.message_storage = MessageStorage(self.ipad_bot)
@@ -407,7 +408,8 @@ class Robot:
self.head_images[wxid] = small_head_img_url
self.contact_manager.set_contacts(self.allContacts, self.head_images)
friends = await self.ipad_bot.get_contract_list()
self.contact_manager.set_contacts(self.allContacts, friends, self.head_images)
self.LOG.info(f"已更新群 {group_id} 的成员信息")
except Exception as e:
self.LOG.error(f"获取群成员信息失败: {e}")
@@ -454,10 +456,11 @@ class Robot:
time.sleep(1)
# 添加一个方法用于刷新联系人信息
def refresh_contacts(self):
async def refresh_contacts(self):
"""刷新联系人信息"""
self.allContacts = self.get_all_contacts()
self.contact_manager.refresh_contacts(self.allContacts)
friends = await self.ipad_bot.get_contract_list()
self.contact_manager.refresh_contacts(self.allContacts,friends)
self.LOG.info("联系人信息已刷新")
async def send_group_txt_message(self, msg: str, feature: Feature):
@@ -607,8 +610,8 @@ class Robot:
self.allContacts[wxid] = nick_name
self.head_images[wxid] = small_head_img_url
self.contact_manager.set_contacts(self.allContacts, self.head_images)
friends = await self.ipad_bot.get_contract_list()
self.contact_manager.set_contacts(self.allContacts, friends, self.head_images)
self.LOG.info(f"已更新群 {group_id} 的成员信息")
else:
self.LOG.error(f"获取群 {group_id} 信息失败,证明用户无该群信息,删除群的相关资料。")