mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-04 00:35:58 +00:00
fix(feishu): send videos with media message type
This commit is contained in:
parent
076e4166d7
commit
39a5a77874
@ -1457,13 +1457,13 @@ class FeishuChannel(BaseChannel):
|
|||||||
else:
|
else:
|
||||||
key = await loop.run_in_executor(None, self._upload_file_sync, file_path)
|
key = await loop.run_in_executor(None, self._upload_file_sync, file_path)
|
||||||
if key:
|
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.
|
# 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:
|
if ext in self._AUDIO_EXTS:
|
||||||
media_type = "audio"
|
media_type = "audio"
|
||||||
elif ext in self._VIDEO_EXTS:
|
elif ext in self._VIDEO_EXTS:
|
||||||
media_type = "video"
|
media_type = "media"
|
||||||
else:
|
else:
|
||||||
media_type = "file"
|
media_type = "file"
|
||||||
await loop.run_in_executor(
|
await loop.run_in_executor(
|
||||||
|
|||||||
@ -202,7 +202,7 @@ def test_reply_message_sync_returns_false_on_exception() -> None:
|
|||||||
("filename", "expected_msg_type"),
|
("filename", "expected_msg_type"),
|
||||||
[
|
[
|
||||||
("voice.opus", "audio"),
|
("voice.opus", "audio"),
|
||||||
("clip.mp4", "video"),
|
("clip.mp4", "media"),
|
||||||
("report.pdf", "file"),
|
("report.pdf", "file"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user