🤔修复管理员转换出错的问题

This commit is contained in:
EillesWan 2024-08-22 03:18:05 +08:00
parent 1300fd95d9
commit 4cc2ae61db
2 changed files with 30 additions and 21 deletions

View File

@ -622,13 +622,6 @@ async def _(
at_sender=True, 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 = { _args: dict = {
"file": "all", "file": "all",
"enable-mismatch-error": False, "enable-mismatch-error": False,
@ -668,6 +661,18 @@ async def _(
# ) # )
nonebot.logger.info(_args) 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_data_path = database_dir / usr_id
(usr_temp_path := temporary_dir / usr_id).mkdir(exist_ok=True) (usr_temp_path := temporary_dir / usr_id).mkdir(exist_ok=True)
@ -1025,12 +1030,12 @@ async def _(
if isinstance(event, GroupMessageEvent) or isinstance( if isinstance(event, GroupMessageEvent) or isinstance(
event, GroupUploadNoticeEvent event, GroupUploadNoticeEvent
): ):
res_id = await bot.call_api( await bot.call_api(
"upload_group_file", group_id=event.group_id, name=fn, file=fp "upload_group_file", group_id=event.group_id, name=fn, file=fp
) )
await linglun_convert.send( # await linglun_convert.send(
UniMessage.text("文件已上传群文件,请在群文件查看。") # UniMessage.text("文件已上传群文件,请在群文件查看。")
) # )
# await linglun_convert.send(UniMessage.file(res_id,path=fp,name=fn)) # await linglun_convert.send(UniMessage.file(res_id,path=fp,name=fn))
else: else:
await bot.call_api( await bot.call_api(

View File

@ -128,13 +128,6 @@ async def _(
at_sender=True, 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 = { _args: dict = {
"file-name": "all", "file-name": "all",
"output-file": False, "output-file": False,
@ -162,6 +155,17 @@ async def _(
# ) # )
nonebot.logger.info(_args) 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]: if _args["mode"] not in [0, 1, 2, 3, 4]:
await mspv_sync.finish( await mspv_sync.finish(
UniMessage.text("模式 {} 不存在,请详阅文档。".format(_args["mode"])) UniMessage.text("模式 {} 不存在,请详阅文档。".format(_args["mode"]))
@ -425,9 +429,9 @@ async def _(
await bot.call_api( await bot.call_api(
"upload_group_file", group_id=event.group_id, name=fn, file=fp "upload_group_file", group_id=event.group_id, name=fn, file=fp
) )
await mspv_sync.send( # await mspv_sync.send(
UniMessage.text("文件已上传群文件,请在群文件查看。") # UniMessage.text("文件已上传群文件,请在群文件查看。")
) # )
else: else:
await bot.call_api( await bot.call_api(
"upload_private_file", user_id=event.user_id, name=fn, file=fp "upload_private_file", user_id=event.user_id, name=fn, file=fp