🎈 perf: add error handling for missing pyffmpeg library in video sending functionality
This commit is contained in:
@@ -84,7 +84,15 @@ class GewechatPlatformEvent(AstrMessageEvent):
|
|||||||
logger.debug(f"gewe callback img url: {img_url}")
|
logger.debug(f"gewe callback img url: {img_url}")
|
||||||
await client.post_image(to_wxid, img_url)
|
await client.post_image(to_wxid, img_url)
|
||||||
elif isinstance(comp, Video):
|
elif isinstance(comp, Video):
|
||||||
|
try:
|
||||||
from pyffmpeg import FFmpeg
|
from pyffmpeg import FFmpeg
|
||||||
|
except (ImportError, ModuleNotFoundError):
|
||||||
|
logger.error(
|
||||||
|
"需要安装 pyffmpeg 库才能发送视频: pip install pyffmpeg"
|
||||||
|
)
|
||||||
|
raise ModuleNotFoundError(
|
||||||
|
"需要安装 pyffmpeg 库才能发送视频: pip install pyffmpeg"
|
||||||
|
)
|
||||||
|
|
||||||
video_url = comp.file
|
video_url = comp.file
|
||||||
# 根据 url 下载视频
|
# 根据 url 下载视频
|
||||||
|
|||||||
Reference in New Issue
Block a user