From 4158e5b76c6841d86769e6fbc75478658f4b67d5 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Fri, 10 Dec 2021 14:07:49 +0800 Subject: [PATCH] fix target query err not response --- src/plugins/nonebot_bison/config_manager.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/nonebot_bison/config_manager.py b/src/plugins/nonebot_bison/config_manager.py index 1ec5d1a..8158ccc 100644 --- a/src/plugins/nonebot_bison/config_manager.py +++ b/src/plugins/nonebot_bison/config_manager.py @@ -61,11 +61,14 @@ def do_add_sub(add_sub: Type[Matcher]): async def parse_id(bot: Bot, event: Event, state: T_State): target = str(event.get_message()).strip() - name = await check_sub_target(state['platform'], target) - if not name: + try: + name = await check_sub_target(state['platform'], target) + if not name: + await add_sub.reject('id输入错误') + state['id'] = target + state['name'] = name + except: await add_sub.reject('id输入错误') - state['id'] = target - state['name'] = name @add_sub.got('id', _gen_prompt_template('{_prompt}'), parse_id) @add_sub.handle()