fix annotation handler call, for better DI process

This commit is contained in:
crazywhalecc
2023-03-11 19:52:12 +08:00
committed by Jerry
parent 560505bb4a
commit cb3d2ee950
2 changed files with 4 additions and 3 deletions

View File

@@ -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;