From 39a5a77874bcb30424861cf9e78894a70d9c8e04 Mon Sep 17 00:00:00 2001 From: Xubin Ren Date: Fri, 24 Apr 2026 20:00:56 +0000 Subject: [PATCH] fix(feishu): send videos with media message type --- nanobot/channels/feishu.py | 6 +++--- tests/channels/test_feishu_reply.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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"), ], )