diff --git a/astrbot/core/platform/sources/wechatpadpro/wechatpadpro_adapter.py b/astrbot/core/platform/sources/wechatpadpro/wechatpadpro_adapter.py index 7746ba889..58e3c9b19 100644 --- a/astrbot/core/platform/sources/wechatpadpro/wechatpadpro_adapter.py +++ b/astrbot/core/platform/sources/wechatpadpro/wechatpadpro_adapter.py @@ -505,7 +505,7 @@ class WeChatPadProAdapter(Platform): # 对于群聊,session_id 可以是群聊 ID 或发送者 ID + 群聊 ID (如果 unique_session 为 True) if self.unique_session: - abm.session_id = f"{from_user_name}_{abm.sender.user_id}" + abm.session_id = f"{from_user_name}#{abm.sender.user_id}" else: abm.session_id = from_user_name @@ -832,7 +832,10 @@ class WeChatPadProAdapter(Platform): # 根据 session_id 判断消息类型 if "@chatroom" in session.session_id: dummy_message_obj.type = MessageType.GROUP_MESSAGE - dummy_message_obj.group_id = session.session_id + if "#" in session.session_id: + dummy_message_obj.group_id = session.session_id.split("#")[0] + else: + dummy_message_obj.group_id = session.session_id dummy_message_obj.sender = MessageMember(user_id="", nickname="") else: dummy_message_obj.type = MessageType.FRIEND_MESSAGE diff --git a/astrbot/core/platform/sources/wechatpadpro/wechatpadpro_message_event.py b/astrbot/core/platform/sources/wechatpadpro/wechatpadpro_message_event.py index ab836ad28..3bb753dd4 100644 --- a/astrbot/core/platform/sources/wechatpadpro/wechatpadpro_message_event.py +++ b/astrbot/core/platform/sources/wechatpadpro/wechatpadpro_message_event.py @@ -81,12 +81,16 @@ class WeChatPadProMessageEvent(AstrMessageEvent): # logger.info(f"已添加 @ 信息: {message_text}") else: message_text = text + if self.get_group_id() and "#" in self.session_id: + session_id = self.session_id.split("#")[0] + else: + session_id = self.session_id payload = { "MsgItem": [ { "MsgType": 1, "TextContent": message_text, - "ToUserName": self.session_id, + "ToUserName": session_id, } ] }