openclaw - 💡(How to fix) Fix [openclaw-weixin] 微信插件缺少发送语音消息功能 [6 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#59761Fetched 2026-04-08 02:40:53
View on GitHub
Comments
6
Participants
3
Timeline
8
Reactions
1
Timeline (top)
commented ×6closed ×1locked ×1
RAW_BUFFERClick to expand / collapse

功能描述

微信插件(@tencent-weixin/openclaw-weixin)目前支持发送图片、视频、文件附件,但缺少发送语音消息的功能。

问题分析

源码中 MessageItemType 定义了四种媒体类型:

  • IMAGE (type=1) → 已实现 sendImageMessageWeixin ✅
  • VIDEO (type=2) → 已实现 sendVideoMessageWeixin ✅
  • FILE (type=3) → 已实现 sendFileMessageWeixin ✅
  • VOICE (type=4) → 缺少 sendVoiceMessageWeixin ❌

当前发送音频文件时会被当作普通文件附件处理,微信端显示为文件而非语音消息。

期望行为

当使用 message 工具发送音频(如 MP3、WAV)到微信时,应以语音消息形式发送,而非文件附件。

技术要求

需要新增 sendVoiceMessageWeixin 函数,构建 MessageItem 时使用 MessageItemType.VOICE(type=4)和对应的 VoiceItem 结构,并在 sendWeixinMediaFile 的 MIME 类型判断中增加 audio/* 的路由处理。

环境信息

  • 插件版本:2.1.3
  • OpenClaw 版本:2026.4.1
  • 微信插件源码:src/messaging/send.ts、src/messaging/send-media.ts、src/api/types.ts(VoiceItem 类型定义)

标签

enhancement

extent analysis

TL;DR

To fix the issue, add a sendVoiceMessageWeixin function that handles audio files with the MessageItemType.VOICE type and updates the MIME type judgment in sendWeixinMediaFile to route audio files correctly.

Guidance

  • Identify the missing sendVoiceMessageWeixin function and create it to handle audio files with the MessageItemType.VOICE type.
  • Update the sendWeixinMediaFile function to include a MIME type check for audio/* to route audio files to the new sendVoiceMessageWeixin function.
  • Verify that the VoiceItem structure is correctly defined in src/api/types.ts to support the sendVoiceMessageWeixin function.
  • Test the updated code with different audio file types (e.g., MP3, WAV) to ensure they are sent as voice messages instead of file attachments.

Example

// src/messaging/send-media.ts
function sendWeixinMediaFile(file: File, type: MessageItemType) {
  // ...
  if (type === MessageItemType.VOICE && file.type.startsWith('audio/')) {
    return sendVoiceMessageWeixin(file);
  }
  // ...
}

// src/messaging/send.ts
function sendVoiceMessageWeixin(file: File) {
  const voiceItem: VoiceItem = {
    // ...
  };
  // Send the voice message using the Weixin API
}

Notes

The solution assumes that the VoiceItem structure is correctly defined in src/api/types.ts and that the Weixin API supports sending voice messages. Additional testing and verification may be necessary to ensure the updated code works as expected.

Recommendation

Apply the workaround by adding the sendVoiceMessageWeixin function and updating the sendWeixinMediaFile function to route audio files correctly, as this will provide the desired functionality of sending audio files as voice messages instead of file attachments.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING