Skip to content

Commit 1fada92

Browse files
committed
Merge pull request #140 from sndnvaps/patch-set1
Update ImageCommand.php
2 parents 3b97af6 + 1823c9a commit 1fada92

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

examples/Commands/ImageCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public function execute()
4141
$data['chat_id'] = $chat_id;
4242
$data['caption'] = $text;
4343

44-
return Request::sendPhoto($data, $this->telegram->getUploadPath().'/'.'image.jpg');
44+
//return Request::sendPhoto($data, $this->telegram->getUploadPath().'/'.'image.jpg');
45+
return Request::sendPhoto($data, $this->ShowRandomImage($this->telegram->getUploadPath()));
4546
}
47+
//return random picture from the telegram->getUploadPath();
48+
49+
private function ShowRandomImage($dir) {
50+
$image_list = scandir($dir);
51+
return $dir . "/" . $image_list[mt_rand(2, count($image_list) - 1)];
52+
}
53+
4654
}

0 commit comments

Comments
 (0)