mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-18 05:04:51 +08:00
fix BotActionResponse status filter
This commit is contained in:
parent
422b13f66f
commit
b97cf26047
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -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 运行时偏好(环境信息&参数)
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user