Files
zhamao-framework/src/ZM/Annotation/OneBot/BotEvent.php

43 lines
1.0 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace ZM\Annotation\OneBot;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;
use ZM\Annotation\AnnotationBase;
2022-12-20 20:10:40 +08:00
use ZM\Annotation\Interfaces\Level;
/**
2022-08-13 17:00:29 +08:00
* 机器人相关事件注解
*
* @Annotation
* @Target("METHOD")
2022-08-13 17:00:29 +08:00
* @NamedArgumentConstructor()
*/
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
2022-12-20 20:10:40 +08:00
class BotEvent extends AnnotationBase implements Level
{
2024-10-02 20:31:16 +08:00
public function __construct(public ?string $type = null, public ?string $detail_type = null, public ?string $sub_type = null, public int $level = 20) {}
2022-08-13 17:00:29 +08:00
public static function make(
?string $type = null,
?string $detail_type = null,
2022-12-20 20:10:40 +08:00
?string $sub_type = null,
int $level = 20,
2022-08-13 17:00:29 +08:00
): BotEvent {
return new static(...func_get_args());
}
2022-12-20 20:10:40 +08:00
public function getLevel(): int
{
return $this->level;
}
public function setLevel($level)
{
$this->level = $level;
}
}