From 3c8983e75302483520366e0f519121df6eb36d02 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Sat, 26 Feb 2022 00:11:26 +0800 Subject: [PATCH] Update task_hook.py --- basic_plugins/hooks/task_hook.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/basic_plugins/hooks/task_hook.py b/basic_plugins/hooks/task_hook.py index 9011e7d28..7cd241e8b 100644 --- a/basic_plugins/hooks/task_hook.py +++ b/basic_plugins/hooks/task_hook.py @@ -14,10 +14,20 @@ async def handle_api_call(bot: Bot, api: str, data: Dict[str, Any]): or api == "send_group_msg" ) and ( - (r := re.search("^\[\[_task\|(.*)]]", str(data["message"]).strip())) + ( + r := re.search( + "^\[\[_task\|(.*)]]", + data["message"].strip() + if isinstance(data["message"], str) + else str(data["message"]["text"]).strip(), + ) + ) or ( r := re.search( - "^[[_task\|(.*)]]", str(data["message"]).strip() + "^[[_task\|(.*)]]", + data["message"].strip() + if isinstance(data["message"], str) + else str(data["message"]["text"]).strip(), ) ) )