fix: wecom userid couldn't pass correctly

This commit is contained in:
wangcham
2025-02-10 09:11:27 -05:00
parent 05c1fdaa9e
commit 7ba655902b
3 changed files with 5 additions and 6 deletions

View File

@@ -171,7 +171,6 @@ class WecomClient():
elif request.method == "POST":
encrypt_msg = await request.data
ret, xml_msg = self.wxcpt.DecryptMsg(encrypt_msg, msg_signature, timestamp, nonce)
# print(xml_msg)
if ret != 0:
raise Exception(f"消息解密失败,错误码: {ret}")

View File

@@ -119,9 +119,8 @@ class WecomEventConverter:
yiri_chain = await WecomMessageConverter.target2yiri(
event.message, event.message_id
)
friend = platform_entities.Friend(
id=event.user_id,
id=f"u{event.user_id}",
nickname=str(event.agent_id),
remark="",
)
@@ -190,12 +189,12 @@ class WecomeAdapter(adapter.MessageSourceAdapter):
message_source, self.bot_account_id, self.bot
)
content_list = await WecomMessageConverter.yiri2target(message, self.bot)
fixed_user_id = Wecom_event.user_id.lstrip('u')
for content in content_list:
if content["type"] == "text":
await self.bot.send_private_msg(Wecom_event.user_id, Wecom_event.agent_id, content["content"])
await self.bot.send_private_msg(fixed_user_id, Wecom_event.agent_id, content["content"])
elif content["type"] == "image":
await self.bot.send_image(Wecom_event.user_id, Wecom_event.agent_id, content["media_id"])
await self.bot.send_image(fixed_user_id, Wecom_event.agent_id, content["media_id"])
async def send_message(
self, target_type: str, target_id: str, message: platform_message.MessageChain

View File

@@ -38,6 +38,7 @@ class Friend(Entity):
return self.nickname or self.remark or ''
class Permission(str, Enum):
"""群成员身份权限。"""
Member = "MEMBER"