mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
fix(jm_download): 添加下载提示和空输入校验
在下载前发送等待提示,并检查输入是否为空
(cherry picked from commit c7695b7459)
This commit is contained in:
parent
feb53b1a31
commit
c49139607e
1 changed files with 4 additions and 0 deletions
|
|
@ -8,8 +8,12 @@ from src.clover_image.delete_file import delete_file
|
||||||
jm = on_command("jm", rule=to_me(), priority=10,block=False)
|
jm = on_command("jm", rule=to_me(), priority=10,block=False)
|
||||||
@jm.handle()
|
@jm.handle()
|
||||||
async def handle_function(message: MessageEvent):
|
async def handle_function(message: MessageEvent):
|
||||||
|
await jm.send("正在下载中,请稍等")
|
||||||
key = message.get_plaintext().replace("/jm", "").strip(" ")
|
key = message.get_plaintext().replace("/jm", "").strip(" ")
|
||||||
|
|
||||||
|
if key == "":
|
||||||
|
await jm.finish("请输入jm的id")
|
||||||
|
|
||||||
output_file = await download_jm(key)
|
output_file = await download_jm(key)
|
||||||
await jm.send(MessageSegment.file_image(Path(output_file)))
|
await jm.send(MessageSegment.file_image(Path(output_file)))
|
||||||
await delete_file(output_file)
|
await delete_file(output_file)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue