mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 15:45:36 +08:00
refactor plugin generator to new format
This commit is contained in:
@@ -6,7 +6,7 @@ namespace {namespace};
|
||||
|
||||
class {class}
|
||||
{
|
||||
#[\BotCommand(match: '测试{name}')]
|
||||
#[\BotCommand(match: '测试{basename}')]
|
||||
public function firstBotCommand(\BotContext $ctx): void
|
||||
{
|
||||
$ctx->reply('这是{name}插件的第一个命令!');
|
||||
|
||||
@@ -5,9 +5,9 @@ declare(strict_types=1);
|
||||
$plugin = new ZMPlugin(__DIR__);
|
||||
|
||||
/*
|
||||
* 发送 "测试{name}",回复 "这是{name}插件的第一个命令!"
|
||||
* 发送 "测试{basename}",回复 "这是{basename}插件的第一个命令!"
|
||||
*/
|
||||
$cmd1 = BotCommand::make('{name}', match: '测试{name}')->on(fn () => '这是{name}插件的第一个命令!');
|
||||
$cmd1 = BotCommand::make('{name}', match: '测试{basename}')->on(fn () => '这是{name}插件的第一个命令!');
|
||||
|
||||
$plugin->addBotCommand($cmd1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user