diff --git a/pkg/platform/sources/gewechat.py b/pkg/platform/sources/gewechat.py index f0df4b43..f93cb299 100644 --- a/pkg/platform/sources/gewechat.py +++ b/pkg/platform/sources/gewechat.py @@ -62,6 +62,11 @@ class GewechatMessageConverter(adapter.MessageConverter): # content_list.append({"type": "image", "image_id": component.image_id}) # pass + + # content_list.append({"type": "image", "image_id": component.image_id}) + #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)) @@ -121,7 +126,11 @@ class GewechatMessageConverter(adapter.MessageConverter): return platform_message.MessageChain([ platform_message.Plain(text=f"[图片处理失败]") ]) - + 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: @@ -365,4 +374,4 @@ class GeWeChatAdapter(adapter.MessagePlatformAdapter): ) async def kill(self) -> bool: - pass \ No newline at end of file + pass diff --git a/pkg/utils/constants.py b/pkg/utils/constants.py index 6019dc1b..5f950139 100644 --- a/pkg/utils/constants.py +++ b/pkg/utils/constants.py @@ -1,4 +1,4 @@ -semantic_version = "v3.4.9.4" +semantic_version = "v3.4.9.5" debug_mode = False