Compare commits

..

6 Commits

Author SHA1 Message Date
Junyan Qin
11b1110eed chore: release v3.4.9.5 2025-02-27 17:04:54 +08:00
Junyan Qin (Chin)
682b897e21 Merge pull request #1130 from fdc310/master
'个人微信中主动发送信息send_message的修改'
2025-02-26 15:54:02 +08:00
Junyan Qin
998ad7623c perf(gewechat): simplify 2025-02-26 15:53:26 +08:00
Junyan Qin (Chin)
4f1db33abc Merge pull request #1131 from shockno1/master
Update gewechat.py 添加gewe微信接口中voice语音的处理
2025-02-26 15:38:56 +08:00
shockno1
ca6cb60bdd Update gewechat.py 添加gewe微信接口中voice语音的处理
添加gewe微信接口中voice语音的处理
2025-02-26 12:45:28 +08:00
Dong_master
133e48a5a9 '个人微信中主动发送信息send_message的修改' 2025-02-26 02:54:42 +08:00
2 changed files with 16 additions and 5 deletions

View File

@@ -43,8 +43,11 @@ class GewechatMessageConverter(adapter.MessageConverter):
elif isinstance(component, platform_message.Plain):
content_list.append({"type": "text", "content": component.text})
elif isinstance(component, platform_message.Image):
content_list.append({"type": "image", "url": component.url})
# content_list.append({"type": "image", "image_id": component.image_id})
pass
#pass
elif isinstance(component, platform_message.Voice):
content_list.append({"type": "voice", "url": component.url, "length": component.length})
elif isinstance(component, platform_message.Forward):
for node in component.node_list:
content_list.extend(await GewechatMessageConverter.yiri2target(node.message_chain))
@@ -103,7 +106,11 @@ class GewechatMessageConverter(adapter.MessageConverter):
return platform_message.MessageChain([
platform_message.Plain(text="[图片处理失败]")
])
elif message["Data"]["MsgType"] == 34:
audio_base64 = message["Data"]["ImgBuf"]["buffer"]
return platform_message.MessageChain(
[platform_message.Voice(base64=f"data:audio/silk;base64,{audio_base64}")]
)
elif message["Data"]["MsgType"] == 49:
# 支持微信聊天记录的消息类型,将 XML 内容转换为 MessageChain 传递
try:
@@ -238,7 +245,11 @@ class GeWeChatAdapter(adapter.MessagePlatformAdapter):
target_id: str,
message: platform_message.MessageChain
):
pass
geweap_msg = await GewechatMessageConverter.yiri2target(message)
for msg in geweap_msg:
if msg['type'] == 'text':
await self.bot.post_text(app_id=self.config['app_id'], to_wxid=target_id,content=msg['content'])
async def reply_message(
self,
@@ -336,4 +347,4 @@ class GeWeChatAdapter(adapter.MessagePlatformAdapter):
)
async def kill(self) -> bool:
pass
pass

View File

@@ -1,4 +1,4 @@
semantic_version = "v3.4.9.4"
semantic_version = "v3.4.9.5"
debug_mode = False