diff --git a/src/ZM/Context/Trait/BotActionTrait.php b/src/ZM/Context/Trait/BotActionTrait.php index 0a4dab10..da8df17a 100644 --- a/src/ZM/Context/Trait/BotActionTrait.php +++ b/src/ZM/Context/Trait/BotActionTrait.php @@ -58,8 +58,8 @@ trait BotActionTrait // 调用事件在回复之前的回调 $handler = new AnnotationHandler(BotAction::class); container()->set(Action::class, $a); - $handler->setRuleCallback(fn (BotAction $act) => $act->action === '' || $act->action === $action && !$act->need_response); - $handler->handleAll($a); + $handler->setRuleCallback(fn (BotAction $act) => ($act->action === '' || $act->action === $action) && !$act->need_response); + $handler->handleAll(); // 被阻断时候,就不发送了 if ($handler->getStatus() === AnnotationHandler::STATUS_INTERRUPTED) { return false; diff --git a/src/ZM/Plugin/OneBot/OneBot12Adapter.php b/src/ZM/Plugin/OneBot/OneBot12Adapter.php index d6934eab..16617229 100644 --- a/src/ZM/Plugin/OneBot/OneBot12Adapter.php +++ b/src/ZM/Plugin/OneBot/OneBot12Adapter.php @@ -430,7 +430,8 @@ class OneBot12Adapter extends ZMPlugin return ($event->retcode === null || $event->retcode === $resp->retcode) && ($event->status === null || $event->status === $resp->status); }); - $handler->handleAll($resp); + container()->set(ActionResponse::class, $resp); + $handler->handleAll(); // 如果有协程,并且该 echo 记录在案的话,就恢复协程 BotContext::tryResume($resp);