Skip to content

Your lightweight open-source personal agent.

fix(feishu): send videos with media message type

Xubin Ren39a5a77874bc
diff --git a/nanobot/channels/feishu.py b/nanobot/channels/feishu.py
index 1442c3637..41e937801 100644
--- a/nanobot/channels/feishu.py
+++ b/nanobot/channels/feishu.py
@@ -1457,13 +1457,13 @@ class FeishuChannel(BaseChannel):
else:
key = await loop.run_in_executor(None, self._upload_file_sync, file_path)
if key:
- # Use msg_type "audio" for audio, "video" for video, "file" for documents.
+ # Feishu's OpenAPI names video messages "media".
+ # Use "audio" for audio, "media" for video, "file" for documents.
# Feishu requires these specific msg_types for inline playback.
- # Note: "media" is only valid as a tag inside "post" messages, not as a standalone msg_type.
if ext in self._AUDIO_EXTS:
media_type = "audio"
elif ext in self._VIDEO_EXTS:
- media_type = "video"
+ media_type = "media"
else:
media_type = "file"
await loop.run_in_executor(
diff --git a/tests/channels/test_feishu_reply.py b/tests/channels/test_feishu_reply.py
index 0753653a7..2ad466dcd 100644
--- a/tests/channels/test_feishu_reply.py
+++ b/tests/channels/test_feishu_reply.py
@@ -202,7 +202,7 @@ def test_reply_message_sync_returns_false_on_exception() -> None:
("filename", "expected_msg_type"),
[
("voice.opus", "audio"),
- ("clip.mp4", "video"),
+ ("clip.mp4", "media"),
("report.pdf", "file"),
],
)