From b97cf26047c53e4d9bfb07461e336df4be8a426e Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 10 Mar 2023 21:43:26 +0800 Subject: [PATCH] fix BotActionResponse status filter --- src/ZM/Annotation/OneBot/BotActionResponse.php | 2 +- src/ZM/Framework.php | 2 +- src/ZM/Plugin/OneBot/OneBot12Adapter.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ZM/Annotation/OneBot/BotActionResponse.php b/src/ZM/Annotation/OneBot/BotActionResponse.php index b74fd2f5..1cec6766 100644 --- a/src/ZM/Annotation/OneBot/BotActionResponse.php +++ b/src/ZM/Annotation/OneBot/BotActionResponse.php @@ -20,7 +20,7 @@ use ZM\Annotation\Interfaces\Level; #[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_METHOD)] class BotActionResponse extends AnnotationBase implements Level { - public function __construct(public ?int $retcode = null, public int $level = 20) + public function __construct(public ?string $status = null, public ?int $retcode = null, public int $level = 20) { } diff --git a/src/ZM/Framework.php b/src/ZM/Framework.php index f250ae0a..4d1492d2 100644 --- a/src/ZM/Framework.php +++ b/src/ZM/Framework.php @@ -50,7 +50,7 @@ class Framework public const VERSION_ID = 704; /** @var string 版本名称 */ - public const VERSION = '3.1.1'; + public const VERSION = '3.1.2'; /** * @var RuntimePreferences 运行时偏好(环境信息&参数) diff --git a/src/ZM/Plugin/OneBot/OneBot12Adapter.php b/src/ZM/Plugin/OneBot/OneBot12Adapter.php index e81c026c..d6934eab 100644 --- a/src/ZM/Plugin/OneBot/OneBot12Adapter.php +++ b/src/ZM/Plugin/OneBot/OneBot12Adapter.php @@ -427,7 +427,8 @@ class OneBot12Adapter extends ZMPlugin // 调用 BotActionResponse 事件 $handler = new AnnotationHandler(BotActionResponse::class); $handler->setRuleCallback(function (BotActionResponse $event) use ($resp) { - return $event->retcode === null || $event->retcode === $resp->retcode; + return ($event->retcode === null || $event->retcode === $resp->retcode) + && ($event->status === null || $event->status === $resp->status); }); $handler->handleAll($resp);