mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-24 16:15:03 +08:00
😓mspvexec:避免文件过大超时导致后续内容无法输出
This commit is contained in:
parent
73563aecfa
commit
59a3c92ff3
@ -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,6 +393,7 @@ async def _(
|
||||
fp := str(temporary_dir / (fn := "mpr-wav-{}.zip".format(usr_id))),
|
||||
)
|
||||
|
||||
try:
|
||||
if isinstance(event, GroupMessageEvent) or isinstance(
|
||||
event, GroupUploadNoticeEvent
|
||||
):
|
||||
@ -402,6 +404,8 @@ async def _(
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user