Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onUpdateReceived(Update update) {
- if (update.hasMessage()) {
- long chat_id = update.getMessage().getChatId();
- List < PhotoSize > photos = update.getMessage().getPhoto();
- String f_id = photos.stream()
- .sorted(Comparator.comparing(PhotoSize::getFileSize).reversed())
- .findFirst()
- .orElse(null).getFileId();
- SendPhoto msg = new SendPhoto()
- .setChatId(chat_id)
- .setPhoto(f_id);
- try {
- sendPhoto(msg);
- } catch (TelegramApiException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement