diff --git a/nanobot/channels/feishu.py b/nanobot/channels/feishu.py index 0376e57..d1eeb2e 100644 --- a/nanobot/channels/feishu.py +++ b/nanobot/channels/feishu.py @@ -555,23 +555,29 @@ class FeishuChannel(BaseChannel): filename = f"{image_key[:16]}.jpg" - elif msg_type in ("audio", "file"): + elif msg_type in ("audio", "file", "media"): file_key = content_json.get("file_key") - if file_key and message_id: data, filename = await loop.run_in_executor( - None, self._download_file_sync, message_id, file_key, msg_type + None, self._download_file_sync, message_id, file_key ) if not filename: - ext = ".opus" if msg_type == "audio" else "" - + if msg_type == "audio": + ext = ".opus" + elif msg_type == "media": + ext = ".mp4" + else: + ext = "" filename = f"{file_key[:16]}{ext}" if data and filename: file_path = media_dir / filename + file_path.write_bytes(data) + logger.debug("Downloaded {} to {}", msg_type, file_path) + return str(file_path), f"[{msg_type}: {filename}]" return None, f"[{msg_type}: download failed]" @@ -698,7 +704,7 @@ class FeishuChannel(BaseChannel): if text: content_parts.append(text) - elif msg_type in ("image", "audio", "file"): + elif msg_type in ("image", "audio", "file", "media"): file_path, content_text = await self._download_and_save_media(msg_type, content_json, message_id) if file_path: media_paths.append(file_path)