mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-20 23:25:35 +08:00
prerelease of beta1
This commit is contained in:
33
src/ZM/Annotation/OneBot/BotAction.php
Normal file
33
src/ZM/Annotation/OneBot/BotAction.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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;
|
||||
use ZM\Annotation\Interfaces\Level;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor()
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||||
class BotAction extends AnnotationBase implements Level
|
||||
{
|
||||
public function __construct(public string $action = '', public bool $need_response = false, public int $level = 20)
|
||||
{
|
||||
}
|
||||
|
||||
public function getLevel()
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
public function setLevel($level)
|
||||
{
|
||||
$this->level = $level;
|
||||
}
|
||||
}
|
||||
36
src/ZM/Annotation/OneBot/BotActionResponse.php
Normal file
36
src/ZM/Annotation/OneBot/BotActionResponse.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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;
|
||||
use ZM\Annotation\Interfaces\Level;
|
||||
|
||||
/**
|
||||
* Class BotActionResponse
|
||||
* 机器人指令注解
|
||||
*
|
||||
* @Annotation
|
||||
* @NamedArgumentConstructor()
|
||||
* @Target("METHOD")
|
||||
*/
|
||||
#[\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 getLevel()
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
public function setLevel($level)
|
||||
{
|
||||
$this->level = $level;
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,20 @@ class BotCommand extends AnnotationBase implements Level
|
||||
/**
|
||||
* @param string[] $alias
|
||||
*/
|
||||
public function __construct(public $name = '', public $match = '', public $pattern = '', public $regex = '', public $start_with = '', public $end_with = '', public $keyword = '', public $alias = [], public $message_type = '', public $user_id = '', public $group_id = '', public $level = 20)
|
||||
{
|
||||
public function __construct(
|
||||
public $name = '',
|
||||
public $match = '',
|
||||
public $pattern = '',
|
||||
public $regex = '',
|
||||
public $start_with = '',
|
||||
public $end_with = '',
|
||||
public $keyword = '',
|
||||
public $alias = [],
|
||||
public $detail_type = '',
|
||||
public $user_id = '',
|
||||
public $group_id = '',
|
||||
public $level = 20
|
||||
) {
|
||||
}
|
||||
|
||||
public static function make(
|
||||
|
||||
@@ -8,6 +8,7 @@ use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use ZM\Annotation\AnnotationBase;
|
||||
use ZM\Annotation\Interfaces\Level;
|
||||
|
||||
/**
|
||||
* 机器人相关事件注解
|
||||
@@ -17,20 +18,28 @@ use ZM\Annotation\AnnotationBase;
|
||||
* @NamedArgumentConstructor()
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||||
class BotEvent extends AnnotationBase
|
||||
class BotEvent extends AnnotationBase implements Level
|
||||
{
|
||||
public function __construct(public ?string $type = null, public ?string $detail_type = null, public ?string $impl = null, public ?string $platform = null, public ?string $self_id = null, public ?string $sub_type = null)
|
||||
public function __construct(public ?string $type = null, public ?string $detail_type = null, public ?string $sub_type = null, public int $level = 20)
|
||||
{
|
||||
}
|
||||
|
||||
public static function make(
|
||||
?string $type = null,
|
||||
?string $detail_type = null,
|
||||
?string $impl = null,
|
||||
?string $platform = null,
|
||||
?string $self_id = null,
|
||||
?string $sub_type = null
|
||||
?string $sub_type = null,
|
||||
int $level = 20,
|
||||
): BotEvent {
|
||||
return new static(...func_get_args());
|
||||
}
|
||||
|
||||
public function getLevel(): int
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
public function setLevel($level)
|
||||
{
|
||||
$this->level = $level;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user