2022-08-13 17:00:29 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
2022-12-18 00:15:34 +08:00
|
|
|
|
$plugin = new ZMPlugin(__DIR__);
|
2022-09-26 22:44:41 +08:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* 发送 "测试 123",回复 "你好,123"
|
|
|
|
|
|
*/
|
|
|
|
|
|
$cmd1 = BotCommand::make('test', '测试')->withArgument('arg1')->on(fn () => '你好,{{arg1}}');
|
|
|
|
|
|
|
2022-08-13 17:00:29 +08:00
|
|
|
|
/*
|
2022-09-26 22:44:41 +08:00
|
|
|
|
* 浏览器访问 http://ip:port/index233,返回内容
|
|
|
|
|
|
*/
|
|
|
|
|
|
$route1 = Route::make('/index233')->on(fn () => '<h1>Hello world</h1>');
|
2022-08-13 17:00:29 +08:00
|
|
|
|
|
2022-09-26 22:44:41 +08:00
|
|
|
|
$plugin->addBotCommand($cmd1);
|
|
|
|
|
|
$plugin->addHttpRoute($route1);
|
2022-08-13 17:00:29 +08:00
|
|
|
|
|
2022-09-26 22:44:41 +08:00
|
|
|
|
return [
|
|
|
|
|
|
'plugin-name' => 'pasd',
|
|
|
|
|
|
'version' => '1.0.0',
|
|
|
|
|
|
'plugin' => $plugin,
|
|
|
|
|
|
];
|