From 59a3c92ff39db0a9c67ef77e32d9a0b1de30b5da Mon Sep 17 00:00:00 2001 From: EillesWan Date: Tue, 23 Jul 2024 03:56:54 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=93mspvexec=EF=BC=9A=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=BF=87=E5=A4=A7=E8=B6=85=E6=97=B6=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=90=8E=E7=BB=AD=E5=86=85=E5=AE=B9=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trimo_plugin_msctconverter/mspvexec.py | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/plugins/trimo_plugin_msctconverter/mspvexec.py b/src/plugins/trimo_plugin_msctconverter/mspvexec.py index 24e5251..d9d7cda 100644 --- a/src/plugins/trimo_plugin_msctconverter/mspvexec.py +++ b/src/plugins/trimo_plugin_msctconverter/mspvexec.py @@ -13,6 +13,7 @@ import nonebot import soundfile import Musicreater import Musicreater.plugin +import nonebot.adapters.onebot.v11.exception from .MusicPreview.main import PreviewMusic @@ -392,16 +393,19 @@ async def _( fp := str(temporary_dir / (fn := "mpr-wav-{}.zip".format(usr_id))), ) - if isinstance(event, GroupMessageEvent) or isinstance( - event, GroupUploadNoticeEvent - ): - await bot.call_api( - "upload_group_file", group_id=event.group_id, name=fn, file=fp - ) - else: - await bot.call_api( - "upload_private_file", user_id=event.user_id, name=fn, file=fp - ) + try: + if isinstance(event, GroupMessageEvent) or isinstance( + event, GroupUploadNoticeEvent + ): + await bot.call_api( + "upload_group_file", group_id=event.group_id, name=fn, file=fp + ) + else: + await bot.call_api( + "upload_private_file", user_id=event.user_id, name=fn, file=fp + ) + except nonebot.adapters.onebot.v11.exception.NetworkError as E: + buffer.write("文件上传发生网络错误:\n{}".format(E)) os.remove(fp)