初始化 Hanson\Vbot\Foundation\Vbot 實例:
```
use Hanson\Vbot\Foundation\Vbot;
$config = [
// ...
];
$vbot = new Vbot($config);
$vbot->messageHandler->setHandler(function(Collection $message){
Text::send($message['from']['UserName'], 'hi');
});
$vbot->server->serve();
```
具體配置如下:
```
$path = __DIR__.'/./../tmp/';
return [
'path' => $path,
/*
* swoole 配置項(執行主動發消息命令必須要開啟,且必須安裝 swoole 插件)
*/
'swoole' => [
'status' => true,
'ip' => '127.0.0.1',
'port' => '8866',
],
/*
* 下載配置項
*/
'download' => [
'image' => true,
'voice' => true,
'video' => true,
'emoticon' => true,
'file' => true,
'emoticon_path' => $path.'emoticons', // 表情庫路徑(PS:表情庫為過濾后不重復的表情文件夾)
],
/*
* 輸出配置項
*/
'console' => [
'output' => true, // 是否輸出
'message' => true, // 是否輸出接收消息 (若上面為 false 此處無效)
],
/*
* 日志配置項
*/
'log' => [
'level' => 'debug',
'permission' => 0777,
'system' => $path.'log', // 系統報錯日志
'message' => $path.'log', // 消息日志
],
/*
* 緩存配置項
*/
'cache' => [
'default' => 'redis', // 緩存設置 (支持 redis 或 file)
'stores' => [
'file' => [
'driver' => 'file',
'path' => $path.'cache',
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
],
/*
* 拓展配置
* ==============================
* 如果加載拓展則必須加載此配置項
*/
'extension' => [
// 管理員配置(必選),優先加載 remark(備注名)
'admin' => [
'remark' => '',
'nickname' => '',
],
// 'other extension' => [ ... ],
],
];
```