添加成员变更提醒。
This commit is contained in:
9
robot.py
9
robot.py
@@ -29,6 +29,7 @@ from utils.robot_cmd.robot_command import GroupBotManager, Feature, PermissionSt
|
||||
from utils.sehuatang.shehuatang import pdf_file_path
|
||||
from utils.sehuatang.shehuatang_undetected import pdf_file_path_undetected
|
||||
from utils.wechat.contact_manager import ContactManager
|
||||
from utils.wechat.member_monitor import ChatroomMemberMonitor
|
||||
from utils.wechat.message_to_db import MessageStorage
|
||||
from wechat_ipad import WechatAPIClient
|
||||
from wechat_ipad.models.appmsg_xml import LINK_XML_NEWS
|
||||
@@ -203,7 +204,7 @@ class Robot:
|
||||
self.contact_manager.set_contacts(self.allContacts, friends, self.head_images, self.all_chatroom_members)
|
||||
|
||||
self.message_storage = MessageStorage(self.ipad_bot)
|
||||
|
||||
self.member_monitor = ChatroomMemberMonitor(self.ipad_bot)
|
||||
# # 获取扩展信息,显示相关内容
|
||||
ext_profile = await self.ipad_bot.get_profile_info_ext()
|
||||
self.ipad_bot.profile_ext = ext_profile
|
||||
@@ -272,6 +273,12 @@ class Robot:
|
||||
# 只有当 Ret 不等于 0 或者 不包含 KeyBuf 时才打印
|
||||
if not (isinstance(data_temp, dict) and data_temp.get("Ret") == 0 and "KeyBuf" in data_temp):
|
||||
self.LOG.debug(f"MESSAGE:{data_temp}")
|
||||
changed_groups = self.member_monitor.parse_mod_contacts_msg(data_temp)
|
||||
if changed_groups:
|
||||
self.LOG.info(f"监测到群成员变动消息,涉及群: {changed_groups}")
|
||||
for group_id in changed_groups:
|
||||
xx = asyncio.create_task(self.member_monitor.check_and_handle_changes(group_id))
|
||||
|
||||
# 使用异步睡眠替代忙等待循环
|
||||
await asyncio.sleep(2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user