Commit ba3d1e80 by HanSon Committed by GitHub

Merge pull request #16 from HanSon/dev

修改获取路径
2 parents 08f33261 ea0b5702
...@@ -15,9 +15,11 @@ composer require hanson/vbot ...@@ -15,9 +15,11 @@ composer require hanson/vbot
2、直接下载[release](https://github.com/HanSon/vbot/files/716645/vbot.zip) 2、直接下载[release](https://github.com/HanSon/vbot/files/716645/vbot.zip)
然后执行``` php example/index.php ``` 即可 然后执行``` php example/index.php ```
*PS:警告!执行前请先查看`index.php`的代码,注释掉你认为不需要的代码,避免对其他人好友造成困扰* PS:运行后二维码将保存于设置的缓存目录,命名为qr.png,控制台也会显示二维码,扫描即可
*警告!执行前请先查看`index.php`的代码,注释掉你认为不需要的代码,避免对其他人好友造成困扰*
# 文档 # 文档
......
...@@ -79,7 +79,7 @@ $robot->server->setMessageHandler(function ($message) use ($path) { ...@@ -79,7 +79,7 @@ $robot->server->setMessageHandler(function ($message) use ($path) {
// 语音消息 // 语音消息
if($message instanceof Voice){ if($message instanceof Voice){
/** @var $message Voice */ /** @var $message Voice */
return '收到一条语音并下载在' . $message->getPath($message::$folder) . "/{$message->msg['MsgId']}.mp3"; return '收到一条语音并下载在' . $message::getPath($message::$folder) . "/{$message->msg['MsgId']}.mp3";
} }
// 撤回信息 // 撤回信息
......
...@@ -17,7 +17,7 @@ namespace Hanson\Vbot\Message; ...@@ -17,7 +17,7 @@ namespace Hanson\Vbot\Message;
trait MediaTrait trait MediaTrait
{ {
public function getPath($folder) public static function getPath($folder)
{ {
$path = server()->config['tmp'] . $folder; $path = server()->config['tmp'] . $folder;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!