From d8cfaede12be30e1c0b7565a4b729ad81bca148c Mon Sep 17 00:00:00 2001 From: EillesWan Date: Sun, 11 Jan 2026 02:44:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E4=B8=8D=E9=80=82=E9=85=8D=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trimo_plugin_msctconverter/msctexec.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py b/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py index 2aba2a7..8f7eb0a 100644 --- a/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py +++ b/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py @@ -476,8 +476,25 @@ async def _( os.makedirs(savepath, exist_ok=True) + if not (file_url := file_infomation.get("url", None)): + file_url = await bot.get_group_file_url( + group_id=int(event.group_id), + file_id=file_infomation["id"], + bus_id=file_infomation["busid"], + ) + if isinstance(file_url, dict): + file_url = file_url.get("url", None) + + if not file_url: + await notece_.finish( + "无法获取文件下载链接:{},此问题通常并非用户所产生,请上报给机器人开发者。".format( + file_infomation["name"], + ), + at_sender=True, + ) + async with aiohttp.ClientSession() as client: - resp = await client.get(file_infomation["url"], verify_ssl=False) + resp = await client.get(file_url, verify_ssl=False) (savepath / file_infomation["name"]).open("wb").write( await resp.content.read() )