diff --git a/basic_plugins/hooks/task_hook.py b/basic_plugins/hooks/task_hook.py index 9011e7d2..7cd241e8 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(), ) ) )