Commit 1823c9ac authored by dnv_aps sn's avatar dnv_aps sn

Update ImageCommand.php

Return Random Picture from the UploadPath();
parent d5338d3f
...@@ -41,6 +41,14 @@ class ImageCommand extends UserCommand ...@@ -41,6 +41,14 @@ class ImageCommand extends UserCommand
$data['chat_id'] = $chat_id; $data['chat_id'] = $chat_id;
$data['caption'] = $text; $data['caption'] = $text;
return Request::sendPhoto($data, $this->telegram->getUploadPath().'/'.'image.jpg'); //return Request::sendPhoto($data, $this->telegram->getUploadPath().'/'.'image.jpg');
return Request::sendPhoto($data, $this->ShowRandomImage($this->telegram->getUploadPath()));
} }
//return random picture from the telegram->getUploadPath();
private function ShowRandomImage($dir) {
$image_list = scandir($dir);
return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)];
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment