From b4e213518bf35352ba388620bc3e84d6f226d6fa Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Mon, 26 Dec 2022 19:11:52 +0800 Subject: [PATCH] x --- basic_plugins/hooks/task_hook.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/basic_plugins/hooks/task_hook.py b/basic_plugins/hooks/task_hook.py index 6675e86d..5b5465ff 100644 --- a/basic_plugins/hooks/task_hook.py +++ b/basic_plugins/hooks/task_hook.py @@ -9,6 +9,8 @@ import re @Bot.on_calling_api async def _(bot: Bot, api: str, data: Dict[str, Any]): r = None + task = None + group_id = None try: if ( ( @@ -37,6 +39,10 @@ async def _(bot: Bot, api: str, data: Dict[str, Any]): ): task = r.group(1) group_id = data["group_id"] + except Exception as e: + logger.error(f"TaskHook ERROR {type(e)}:{e}") + else: + if task and group_id: if ( group_manager.get_group_level(group_id) < 0 or not group_manager.check_task_status(task, group_id) @@ -48,5 +54,3 @@ async def _(bot: Bot, api: str, data: Dict[str, Any]): f"[[_task|{task}]]", "" ) data["message"] = Message(msg) - except Exception as e: - logger.error(f"TaskHook ERROR {type(e)}:{e}")