diff --git a/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py b/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py index 86470ff..8795f8a 100644 --- a/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py +++ b/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py @@ -622,13 +622,6 @@ async def _( at_sender=True, ) - if (usr_id not in filesaves.keys()) and ( - superuser_permission and not len(filesaves) - ): - await linglun_convert.finish( - UniMessage.text("服务器内未存入你的任何文件,请先使用上传midi文件吧") - ) - _args: dict = { "file": "all", "enable-mismatch-error": False, @@ -668,6 +661,18 @@ async def _( # ) nonebot.logger.info(_args) + if ((not superuser_permission) and (usr_id not in filesaves.keys())) or ( + superuser_permission + and ( + (not len(filesaves)) + or (_args["file"].lower() == "all" and usr_id not in filesaves.keys()) + ) + ): + await linglun_convert.finish( + UniMessage.text("服务器内未存入你的任何文件,请先上传midi文件吧") + ) + return + # usr_data_path = database_dir / usr_id (usr_temp_path := temporary_dir / usr_id).mkdir(exist_ok=True) @@ -1025,12 +1030,12 @@ async def _( if isinstance(event, GroupMessageEvent) or isinstance( event, GroupUploadNoticeEvent ): - res_id = await bot.call_api( + await bot.call_api( "upload_group_file", group_id=event.group_id, name=fn, file=fp ) - await linglun_convert.send( - UniMessage.text("文件已上传群文件,请在群文件查看。") - ) + # await linglun_convert.send( + # UniMessage.text("文件已上传群文件,请在群文件查看。") + # ) # await linglun_convert.send(UniMessage.file(res_id,path=fp,name=fn)) else: await bot.call_api( diff --git a/src/nonebot_plugins/trimo_plugin_msctconverter/mspvexec.py b/src/nonebot_plugins/trimo_plugin_msctconverter/mspvexec.py index fe78b71..0b51676 100644 --- a/src/nonebot_plugins/trimo_plugin_msctconverter/mspvexec.py +++ b/src/nonebot_plugins/trimo_plugin_msctconverter/mspvexec.py @@ -128,13 +128,6 @@ async def _( at_sender=True, ) - if (usr_id not in filesaves.keys()) and ( - superuser_permission and not len(filesaves) - ): - await mspv_sync.finish( - UniMessage.text("服务器内未存入你的任何文件,请先使用上传midi文件吧") - ) - _args: dict = { "file-name": "all", "output-file": False, @@ -162,6 +155,17 @@ async def _( # ) nonebot.logger.info(_args) + if ((not superuser_permission) and (usr_id not in filesaves.keys())) or ( + superuser_permission + and ( + (not len(filesaves)) + or (_args["file-name"].lower() == "all" and usr_id not in filesaves.keys()) + ) + ): + await mspv_sync.finish( + UniMessage.text("服务器内未存入你的任何文件,请先上传midi文件吧") + ) + if _args["mode"] not in [0, 1, 2, 3, 4]: await mspv_sync.finish( UniMessage.text("模式 {} 不存在,请详阅文档。".format(_args["mode"])) @@ -425,9 +429,9 @@ async def _( await bot.call_api( "upload_group_file", group_id=event.group_id, name=fn, file=fp ) - await mspv_sync.send( - UniMessage.text("文件已上传群文件,请在群文件查看。") - ) + # await mspv_sync.send( + # UniMessage.text("文件已上传群文件,请在群文件查看。") + # ) else: await bot.call_api( "upload_private_file", user_id=event.user_id, name=fn, file=fp