mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-06 00:05:36 +08:00
add command manual plugin (#210)
This commit is contained in:
@@ -7,7 +7,11 @@ namespace Module\Example;
|
||||
use OneBot\Driver\Event\WebSocket\WebSocketMessageEvent;
|
||||
use ZM\Annotation\Http\Route;
|
||||
use ZM\Annotation\Middleware\Middleware;
|
||||
use ZM\Annotation\OneBot\BotCommand;
|
||||
use ZM\Annotation\OneBot\BotEvent;
|
||||
use ZM\Annotation\OneBot\CommandArgument;
|
||||
use ZM\Annotation\OneBot\CommandHelp;
|
||||
use ZM\Context\BotContext;
|
||||
use ZM\Middleware\TimerMiddleware;
|
||||
|
||||
class Hello123
|
||||
@@ -24,4 +28,12 @@ class Hello123
|
||||
{
|
||||
logger()->info("收到了 {$event->getType()}.{$event->getDetailType()} 事件");
|
||||
}
|
||||
|
||||
#[BotCommand('echo', 'echo')]
|
||||
#[CommandArgument('text', '要回复的内容', required: true)]
|
||||
#[CommandHelp('复读机', '只需要发送 echo+内容 即可自动复读', 'echo 你好 会回复 你好')]
|
||||
public function repeat(\OneBotEvent $event, BotContext $context): void
|
||||
{
|
||||
$context->reply($event->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user