ParseTargetException可以携带prompt参数 (#479)

*  ParseTargetException可以携带prompt参数

*  丰富prompt提示
This commit is contained in:
Azide
2024-05-19 22:02:23 +08:00
committed by GitHub
parent 4bbcd9238c
commit 307739e37a
6 changed files with 34 additions and 10 deletions
+4 -2
View File
@@ -86,8 +86,10 @@ def do_add_sub(add_sub: type[Matcher]):
await add_sub.reject("id输入错误")
state["id"] = raw_id_text
state["name"] = name
except Platform.ParseTargetException:
await add_sub.reject("不能从你的输入中提取出id,请检查你输入的内容是否符合预期")
except Platform.ParseTargetException as e:
await add_sub.reject(
"不能从你的输入中提取出id,请检查你输入的内容是否符合预期" + (f"\n{e.prompt}" if e.prompt else "")
)
else:
await add_sub.send(
f"即将订阅的用户为:{state['platform']} {state['name']} {state['id']}\n如有错误请输入“取消”重新订阅"