getUserProfilePhotos() public static method

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
public static getUserProfilePhotos ( array $data ) : ServerResponse
$data array
return Longman\TelegramBot\Entities\ServerResponse
 /**
  * Command execute method
  *
  * @return mixed
  * @throws \Longman\TelegramBot\Exception\TelegramException
  */
 public function execute()
 {
     $message = $this->getMessage();
     $chat_id = $message->getChat()->getId();
     $command = $message->getCommand();
     $text = trim($message->getText(true));
     $data = ['chat_id' => $chat_id];
     //No point in replying to messages in private chats
     if (!$message->getChat()->isPrivateChat()) {
         $data['reply_to_message_id'] = $message->getMessageId();
     }
     if ($command !== 'whois') {
         $text = substr($command, 5);
         //We need that '-' now, bring it back
         if (strpos($text, 'g') === 0) {
             $text = str_replace('g', '-', $text);
         }
     }
     if ($text === '') {
         $text = 'Provide the id to lookup: /whois <id>';
     } else {
         $user_id = $text;
         $chat = null;
         $created_at = null;
         $updated_at = null;
         $result = null;
         if (is_numeric($text)) {
             $results = DB::selectChats(true, true, true, null, null, $user_id);
             if (!empty($results)) {
                 $result = reset($results);
             }
         } else {
             $results = DB::selectChats(true, true, true, null, null, null, $text);
             if (is_array($results) && count($results) === 1) {
                 $result = reset($results);
             }
         }
         if (is_array($result)) {
             $result['id'] = $result['chat_id'];
             $chat = new Chat($result);
             $user_id = $result['id'];
             $created_at = $result['chat_created_at'];
             $updated_at = $result['chat_updated_at'];
             $old_id = $result['old_id'];
         }
         if ($chat !== null) {
             if ($chat->isPrivateChat()) {
                 $text = 'User ID: ' . $user_id . PHP_EOL;
                 $text .= 'Name: ' . $chat->getFirstName() . ' ' . $chat->getLastName() . PHP_EOL;
                 $username = $chat->getUsername();
                 if ($username !== null && $username !== '') {
                     $text .= 'Username: @' . $username . PHP_EOL;
                 }
                 $text .= 'First time seen: ' . $created_at . PHP_EOL;
                 $text .= 'Last activity: ' . $updated_at . PHP_EOL;
                 //Code from Whoami command
                 $limit = 10;
                 $offset = null;
                 $response = Request::getUserProfilePhotos(['user_id' => $user_id, 'limit' => $limit, 'offset' => $offset]);
                 if ($response->isOk()) {
                     /** @var UserProfilePhotos $user_profile_photos */
                     $user_profile_photos = $response->getResult();
                     if ($user_profile_photos->getTotalCount() > 0) {
                         $photos = $user_profile_photos->getPhotos();
                         /** @var PhotoSize $photo */
                         $photo = $photos[0][2];
                         $file_id = $photo->getFileId();
                         $data['photo'] = $file_id;
                         $data['caption'] = $text;
                         return Request::sendPhoto($data);
                     }
                 }
             } elseif ($chat->isGroupChat()) {
                 $text = 'Chat ID: ' . $user_id . (!empty($old_id) ? ' (previously: ' . $old_id . ')' : '') . PHP_EOL;
                 $text .= 'Type: ' . ucfirst($chat->getType()) . PHP_EOL;
                 $text .= 'Title: ' . $chat->getTitle() . PHP_EOL;
                 $text .= 'First time added to group: ' . $created_at . PHP_EOL;
                 $text .= 'Last activity: ' . $updated_at . PHP_EOL;
             }
         } elseif (is_array($results) && count($results) > 1) {
             $text = 'Multiple chats matched!';
         } else {
             $text = 'Chat not found!';
         }
     }
     $data['text'] = $text;
     return Request::sendMessage($data);
 }
 public function execute()
 {
     $update = $this->getUpdate();
     $message = $this->getMessage();
     $user_id = $message->getFrom()->getId();
     $chat_id = $message->getChat()->getId();
     $message_id = $message->getMessageId();
     $text = $message->getText(true);
     //send chat action
     Request::sendChatAction(['chat_id' => $chat_id, 'action' => 'typing']);
     $caption = 'Your Id: ' . $message->getFrom()->getId();
     $caption .= "\n" . 'Name: ' . $message->getFrom()->getFirstName() . ' ' . $message->getFrom()->getLastName();
     $caption .= "\n" . 'Username: '******'user_id' => $user_id, 'limit' => $limit, 'offset' => $offset]);
     //Check if the request isOK
     if ($ServerResponse->isOk()) {
         $UserProfilePhoto = $ServerResponse->getResult();
         $totalcount = $UserProfilePhoto->getTotalCount();
     } else {
         $totalcount = 0;
     }
     $data = [];
     $data['chat_id'] = $chat_id;
     $data['reply_to_message_id'] = $message_id;
     if ($totalcount > 0) {
         $photos = $UserProfilePhoto->getPhotos();
         //I pick the latest photo with the hight definition
         $photo = $photos[0][2];
         $file_id = $photo->getFileId();
         $data['photo'] = $file_id;
         $data['caption'] = $caption;
         $result = Request::sendPhoto($data);
         //Download the image pictures
         //Download after send message response to speedup response
         $file_id = $photo->getFileId();
         $ServerResponse = Request::getFile(['file_id' => $file_id]);
         if ($ServerResponse->isOk()) {
             Request::downloadFile($ServerResponse->getResult());
         }
     } else {
         //No Photo just send text
         $data['text'] = $caption;
         $result = Request::sendMessage($data);
     }
     return $result;
 }
 /**
  * Command execute method
  *
  * @return mixed
  * @throws \Longman\TelegramBot\Exception\TelegramException
  */
 public function execute()
 {
     $message = $this->getMessage();
     $from = $message->getFrom();
     $user_id = $from->getId();
     $chat_id = $message->getChat()->getId();
     $message_id = $message->getMessageId();
     $data = ['chat_id' => $chat_id, 'reply_to_message_id' => $message_id];
     //Send chat action
     Request::sendChatAction(['chat_id' => $chat_id, 'action' => 'typing']);
     $caption = sprintf('Your Id: %d' . PHP_EOL . 'Name: %s %s' . PHP_EOL . 'Username: %s', $user_id, $from->getFirstName(), $from->getLastName(), $from->getUsername());
     //Fetch user profile photo
     $limit = 10;
     $offset = null;
     $response = Request::getUserProfilePhotos(['user_id' => $user_id, 'limit' => $limit, 'offset' => $offset]);
     if ($response->isOk()) {
         /** @var UserProfilePhotos $user_profile_photos */
         $user_profile_photos = $response->getResult();
         if ($user_profile_photos->getTotalCount() > 0) {
             $photos = $user_profile_photos->getPhotos();
             /** @var PhotoSize $photo */
             $photo = $photos[0][2];
             $file_id = $photo->getFileId();
             $data['photo'] = $file_id;
             $data['caption'] = $caption;
             $result = Request::sendPhoto($data);
             //Download the photo after send message response to speedup response
             $response2 = Request::getFile(['file_id' => $file_id]);
             if ($response2->isOk()) {
                 /** @var File $photo_file */
                 $photo_file = $response2->getResult();
                 Request::downloadFile($photo_file);
             }
             return $result;
         }
     }
     //No Photo just send text
     $data['text'] = $caption;
     return Request::sendMessage($data);
 }