Skip to content

Commit

Permalink
feat: update quoted message format
Browse files Browse the repository at this point in the history
  • Loading branch information
hanfangyuan4396 committed Jan 17, 2025
1 parent 51e8b54 commit d7e0ef0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions channel/chat_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def _compose_context(self, ctype: ContextType, content, **kwargs):
else:
context["session_id"] = cmsg.other_user_id
context["receiver"] = cmsg.other_user_id
e_context = PluginManager().emit_event(
EventContext(Event.ON_RECEIVE_MESSAGE, {"channel": self, "context": context}))
e_context = PluginManager().emit_event(EventContext(Event.ON_RECEIVE_MESSAGE, {"channel": self, "context": context}))
context = e_context["context"]
if e_context.is_pass() or context is None:
return context
Expand Down
8 changes: 3 additions & 5 deletions channel/gewechat/gewechat_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def __init__(self, msg, client: GewechatClient):
displayname = refermsg.find('displayname').text
quoted_content = refermsg.find('content').text
title = appmsg.find('title').text
self.content = f"「引用内容\n{displayname}: {quoted_content}\n{title}"
self.content = f"「{displayname}: {quoted_content}----------\n{title}"
else:
self.content = content_xml
elif msg_type is not None and msg_type.text == '5': # 可能是公众号文章
Expand Down Expand Up @@ -456,8 +456,7 @@ def __init__(self, msg, client: GewechatClient):
}
"""
# 获取实际发送者wxid
self.actual_user_id = self.msg.get('Data', {}).get('Content', {}).get('string', '').split(':', 1)[
0] # 实际发送者ID
self.actual_user_id = self.msg.get('Data', {}).get('Content', {}).get('string', '').split(':', 1)[0] # 实际发送者ID
# 从群成员列表中获取实际发送者信息
"""
{
Expand All @@ -480,8 +479,7 @@ def __init__(self, msg, client: GewechatClient):
}
"""
chatroom_member_list_response = self.client.get_chatroom_member_list(self.app_id, self.from_user_id)
if chatroom_member_list_response.get('ret', 0) == 200 and chatroom_member_list_response.get('data', {}).get(
'memberList', []):
if chatroom_member_list_response.get('ret', 0) == 200 and chatroom_member_list_response.get('data', {}).get('memberList', []):
# 从群成员列表中匹配acual_user_id
for member_info in chatroom_member_list_response['data']['memberList']:
if member_info['wxid'] == self.actual_user_id:
Expand Down

0 comments on commit d7e0ef0

Please sign in to comment.