mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-20 15:15:35 +08:00
separate ZMPlugin to traits
This commit is contained in:
26
src/ZM/Plugin/Traits/BotCommandTrait.php
Normal file
26
src/ZM/Plugin/Traits/BotCommandTrait.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace ZM\Plugin\Traits;
|
||||
|
||||
use ZM\Annotation\OneBot\BotCommand;
|
||||
|
||||
trait BotCommandTrait
|
||||
{
|
||||
/** @var array 机器人指令列表 */
|
||||
protected array $bot_commands = [];
|
||||
|
||||
/**
|
||||
* 添加一个 OneBot 机器人命令
|
||||
*
|
||||
* @param BotCommand $command BotCommand 注解对象
|
||||
*/
|
||||
public function addBotCommand(BotCommand $command): void
|
||||
{
|
||||
$this->bot_commands[] = $command;
|
||||
}
|
||||
|
||||
public function getBotCommands(): array
|
||||
{
|
||||
return $this->bot_commands;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user