require_once __DIR__.'/vendor/autoload.php';
$path = __DIR__.'/tmp/';
$options = [ 'path' => $path,
'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', ],
'console' => [ 'output' => true, 'message' => true, ],
'log' => [ 'level' => 'debug', 'permission' => 0777, 'system' => $path.'log', 'message' => $path.'log', ],
'cache' => [ 'default' => 'redis', 'stores' => [ 'file' => [ 'driver' => 'file', 'path' => $path.'cache', ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', ], ], ],
'extension' => [ 'admin' => [ 'remark' => '', 'nickname' => '', ], ], ];
$vbot = new Hanson\Vbot\Foundation\Vbot($options);
$vbot->messageHandler->setHandler(function ($message) { Hanson\Vbot\Message\Text::send($message['from']['UserName'], 'Hi, I\'m Vbot!'); });
$vbot->server->serve();
|