org.telegram.telegrambots.meta.api.objects.Message Java Examples
The following examples show how to use
org.telegram.telegrambots.meta.api.objects.Message.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilesHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private void onDeleteCommandWithoutParameters(Message message, String language) throws InvalidObjectException, TelegramApiException { DatabaseManager.getInstance().addUserForFile(message.getFrom().getId(), DELETE_UPLOADED_STATUS); SendMessage sendMessageRequest = new SendMessage(); sendMessageRequest.setText(LocalisationService.getString("deleteUploadedFile", language)); sendMessageRequest.setChatId(message.getChatId()); HashMap<String, String> files = DatabaseManager.getInstance().getFilesByUser(message.getFrom().getId()); ReplyKeyboardMarkup replyKeyboardMarkup = new ReplyKeyboardMarkup(); if (files.size() > 0) { List<KeyboardRow> commands = new ArrayList<>(); for (Map.Entry<String, String> entry : files.entrySet()) { KeyboardRow commandRow = new KeyboardRow(); commandRow.add(Commands.deleteCommand + " " + entry.getKey() + " " + Emoji.LEFT_RIGHT_ARROW.toString() + " " + entry.getValue()); commands.add(commandRow); } replyKeyboardMarkup.setResizeKeyboard(true); replyKeyboardMarkup.setOneTimeKeyboard(true); replyKeyboardMarkup.setKeyboard(commands); } sendMessageRequest.setReplyMarkup(replyKeyboardMarkup); execute(sendMessageRequest); }
Example #2
Source File: TelegramLongPollingSessionBot.java From TelegramBots with MIT License | 6 votes |
@Override public void onUpdateReceived(Update update) { Optional<Session> chatSession; Message message; if (update.hasMessage()) { message = update.getMessage(); } else if (update.hasCallbackQuery()) { message = update.getCallbackQuery().getMessage(); } else { chatSession = Optional.empty(); onUpdateReceived(update, chatSession); return; } chatIdConverter.setSessionId(message.getChatId()); chatSession = this.getSession(message); onUpdateReceived(update, chatSession); }
Example #3
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage onAlertNewOptionSelected(Message message, String language) { SendMessage sendMessageRequest = null; if (message.hasText()) { if (message.getText().equals(getCancelCommand(language))) { SendMessage sendMessage = new SendMessage(); sendMessage.enableMarkdown(true); sendMessage.setChatId(message.getChatId()); sendMessage.setReplyToMessageId(message.getMessageId()); sendMessage.setReplyMarkup(getAlertsKeyboard(language)); sendMessage.setText(LocalisationService.getString("alertsMenuMessage", language)); DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), ALERT); sendMessageRequest = sendMessage; } else { sendMessageRequest = onNewAlertCityReceived(message, language); } } return sendMessageRequest; }
Example #4
Source File: FilesHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private void onSetLanguageCommand(Message message, String language) throws InvalidObjectException, TelegramApiException { SendMessage sendMessageRequest = new SendMessage(); sendMessageRequest.setChatId(message.getChatId()); ReplyKeyboardMarkup replyKeyboardMarkup = new ReplyKeyboardMarkup(); List<LocalisationService.Language> languages = LocalisationService.getSupportedLanguages(); List<KeyboardRow> commands = new ArrayList<>(); for (LocalisationService.Language languageItem : languages) { KeyboardRow commandRow = new KeyboardRow(); commandRow.add(languageItem.getCode() + " " + Emoji.LEFT_RIGHT_ARROW.toString() + " " + languageItem.getName()); commands.add(commandRow); } replyKeyboardMarkup.setResizeKeyboard(true); replyKeyboardMarkup.setOneTimeKeyboard(true); replyKeyboardMarkup.setKeyboard(commands); replyKeyboardMarkup.setSelective(true); sendMessageRequest.setReplyMarkup(replyKeyboardMarkup); sendMessageRequest.setText(LocalisationService.getString("chooselanguage", language)); execute(sendMessageRequest); languageMessages.add(message.getFrom().getId()); }
Example #5
Source File: DirectionsHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private void onSetLanguageCommand(Message message, String language) throws InvalidObjectException { SendMessage sendMessageRequest = new SendMessage(); sendMessageRequest.setChatId(message.getChatId()); ReplyKeyboardMarkup replyKeyboardMarkup = new ReplyKeyboardMarkup(); List<LocalisationService.Language> languages = LocalisationService.getSupportedLanguages(); List<KeyboardRow> commands = new ArrayList<>(); for (LocalisationService.Language languageItem : languages) { KeyboardRow commandRow = new KeyboardRow(); commandRow.add(languageItem.getCode() + " --> " + languageItem.getName()); commands.add(commandRow); } replyKeyboardMarkup.setResizeKeyboard(true); replyKeyboardMarkup.setOneTimeKeyboard(true); replyKeyboardMarkup.setKeyboard(commands); replyKeyboardMarkup.setSelective(true); sendMessageRequest.setReplyMarkup(replyKeyboardMarkup); sendMessageRequest.setText(LocalisationService.getString("chooselanguage", language)); try { execute(sendMessageRequest); languageMessages.add(message.getFrom().getId()); } catch (TelegramApiException e) { BotLogger.error(LOGTAG, e); } }
Example #6
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage onCurrentChoosen(Message message, String language) { SendMessage sendMessage = new SendMessage(); sendMessage.enableMarkdown(true); ReplyKeyboardMarkup replyKeyboardMarkup = getRecentsKeyboard(message.getFrom().getId(), language); sendMessage.setReplyMarkup(replyKeyboardMarkup); sendMessage.setReplyToMessageId(message.getMessageId()); sendMessage.setChatId(message.getChatId()); if (replyKeyboardMarkup.getKeyboard().size() > 3) { sendMessage.setText(LocalisationService.getString("onCurrentCommandFromHistory", language)); } else { sendMessage.setText(LocalisationService.getString("onCurrentCommandWithoutHistory", language)); } DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), CURRENTWEATHER); return sendMessage; }
Example #7
Source File: ExampleBot.java From telegram-spring-boot-starter-example with MIT License | 6 votes |
@Override public void onUpdateReceived(Update update) { if (update.hasMessage()) { Message message = update.getMessage(); SendMessage response = new SendMessage(); Long chatId = message.getChatId(); response.setChatId(chatId); String text = message.getText(); response.setText(text); try { execute(response); logger.info("Sent message \"{}\" to {}", text, chatId); } catch (TelegramApiException e) { logger.error("Failed to send message \"{}\" to {} due to error: {}", text, chatId, e.getMessage()); } } }
Example #8
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage messageOnMainMenu(Message message, String language) { SendMessage sendMessageRequest; if (message.hasText()) { if (message.getText().equals(getCurrentCommand(language))) { sendMessageRequest = onCurrentChoosen(message, language); } else if (message.getText().equals(getForecastCommand(language))) { sendMessageRequest = onForecastChoosen(message, language); } else if (message.getText().equals(getSettingsCommand(language))) { sendMessageRequest = onSettingsChoosen(message, language); } else if (message.getText().equals(getRateCommand(language))) { sendMessageRequest = sendRateMessage(message.getChatId(), message.getMessageId(), null, language); } else { sendMessageRequest = sendChooseOptionMessage(message.getChatId(), message.getMessageId(), getMainMenuKeyboard(language), language); } } else { sendMessageRequest = sendChooseOptionMessage(message.getChatId(), message.getMessageId(), getMainMenuKeyboard(language), language); } return sendMessageRequest; }
Example #9
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage onCurrentWeather(Message message, String language) { SendMessage sendMessageRequest = null; if (message.hasText()) { if (message.getText().startsWith(getNewCommand(language))) { sendMessageRequest = onNewCurrentWeatherCommand(message.getChatId(), message.getFrom().getId(), message.getMessageId(), language); } else if (message.getText().startsWith(getLocationCommand(language))) { sendMessageRequest = onLocationCurrentWeatherCommand(message.getChatId(), message.getFrom().getId(), message.getMessageId(), language); } else if (message.getText().startsWith(getCancelCommand(language))) { sendMessageRequest = onCancelCommand(message.getChatId(), message.getFrom().getId(), message.getMessageId(), getMainMenuKeyboard(language), language); } else { sendMessageRequest = onCurrentWeatherCityReceived(message.getChatId(), message.getFrom().getId(), message.getMessageId(), message.getText(), language); } } return sendMessageRequest; }
Example #10
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage onAlertOptionSelected(Message message, String language) { SendMessage sendMessageRequest = null; if (message.hasText()) { if (message.getText().equals(getNewCommand(language))) { sendMessageRequest = onNewAlertCommand(message, language); } else if (message.getText().equals(getDeleteCommand(language))) { sendMessageRequest = onDeleteAlertCommand(message, language); } else if (message.getText().equals(getListCommand(language))) { sendMessageRequest = onListAlertCommand(message, language); } else if (message.getText().equals(getBackCommand(language))) { sendMessageRequest = onBackAlertCommand(message, language); } else { sendMessageRequest = sendChooseOptionMessage(message.getChatId(), message.getMessageId(), getAlertsKeyboard(language), language); } } return sendMessageRequest; }
Example #11
Source File: TestUtils.java From TelegramBots with MIT License | 6 votes |
@NotNull static Update mockFullUpdate(AbilityBot bot, User user, String args) { bot.users().put(USER.getId(), USER); bot.users().put(CREATOR.getId(), CREATOR); bot.userIds().put(CREATOR.getUserName(), CREATOR.getId()); bot.userIds().put(USER.getUserName(), USER.getId()); bot.admins().add(CREATOR.getId()); Update update = mock(Update.class); when(update.hasMessage()).thenReturn(true); Message message = mock(Message.class); when(message.getFrom()).thenReturn(user); when(message.getText()).thenReturn(args); when(message.hasText()).thenReturn(true); when(message.isUserMessage()).thenReturn(true); when(message.getChatId()).thenReturn((long) user.getId()); when(update.getMessage()).thenReturn(message); return update; }
Example #12
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage onForecastWeather(Message message, String language) { SendMessage sendMessageRequest = null; if (message.hasText()) { if (message.getText().startsWith(getNewCommand(language))) { sendMessageRequest = onNewForecastWeatherCommand(message.getChatId(), message.getFrom().getId(), message.getMessageId(), language); } else if (message.getText().startsWith(getLocationCommand(language))) { sendMessageRequest = onLocationForecastWeatherCommand(message.getChatId(), message.getFrom().getId(), message.getMessageId(), language); } else if (message.getText().startsWith(getCancelCommand(language))) { sendMessageRequest = onCancelCommand(message.getChatId(), message.getFrom().getId(), message.getMessageId(), getMainMenuKeyboard(language), language); } else { sendMessageRequest = onForecastWeatherCityReceived(message.getChatId(), message.getFrom().getId(), message.getMessageId(), message.getText(), language); } } return sendMessageRequest; }
Example #13
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage onForecastChoosen(Message message, String language) { SendMessage sendMessage = new SendMessage(); sendMessage.enableMarkdown(true); ReplyKeyboardMarkup replyKeyboardMarkup = getRecentsKeyboard(message.getFrom().getId(), language); sendMessage.setReplyMarkup(replyKeyboardMarkup); sendMessage.setReplyToMessageId(message.getMessageId()); sendMessage.setChatId(message.getChatId()); if (replyKeyboardMarkup.getKeyboard().size() > 3) { sendMessage.setText(LocalisationService.getString("onForecastCommandFromHistory", language)); } else { sendMessage.setText(LocalisationService.getString("onForecastCommandWithoutHistory", language)); } DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), FORECASTWEATHER); return sendMessage; }
Example #14
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage onDeleteAlertCommand(Message message, String language) { SendMessage sendMessage = new SendMessage(); sendMessage.enableMarkdown(true); sendMessage.setChatId(message.getChatId()); ReplyKeyboardMarkup replyKeyboardMarkup = getAlertsListKeyboard(message.getFrom().getId(), language); if (replyKeyboardMarkup != null) { sendMessage.setReplyMarkup(replyKeyboardMarkup); sendMessage.setText(LocalisationService.getString("chooseNewAlertCity", language)); DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), ALERTDELETE); } else { sendMessage.setReplyMarkup(getAlertsKeyboard(language)); sendMessage.setText(LocalisationService.getString("noAlertList", language)); } sendMessage.setReplyToMessageId(message.getMessageId()); return sendMessage; }
Example #15
Source File: TransifexHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private void sendMovedToMessage(Message message) throws InvalidObjectException, TelegramApiException { String language = DatabaseManager.getInstance().getUserLanguage(message.getFrom().getId()); SendMessage answer = new SendMessage(); answer.setChatId(message.getChatId()); answer.setReplyToMessageId(message.getMessageId()); answer.setText(LocalisationService.getString("movedToLangBot", language)); InlineKeyboardMarkup inlineKeyboardMarkup = new InlineKeyboardMarkup(); List<List<InlineKeyboardButton>> rows = new ArrayList<>(); List<InlineKeyboardButton> row = new ArrayList<>(); InlineKeyboardButton button = new InlineKeyboardButton(); button.setText(LocalisationService.getString("checkLangBot", language)); button.setUrl("https://telegram.me/langbot"); row.add(button); rows.add(row); inlineKeyboardMarkup.setKeyboard(rows); answer.setReplyMarkup(inlineKeyboardMarkup); execute(answer); }
Example #16
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage messageOnCurrentWeather(Message message, String language, int state) { SendMessage sendMessageRequest = null; switch(state) { case CURRENTWEATHER: sendMessageRequest = onCurrentWeather(message, language); break; case CURRENTNEWWEATHER: sendMessageRequest = onCurrentNewWeather(message, language); break; case CURRENTLOCATIONWEATHER: sendMessageRequest = onCurrentWeatherLocation(message, language); break; } return sendMessageRequest; }
Example #17
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 6 votes |
private static SendMessage messageOnSetting(Message message, String language) { SendMessage sendMessageRequest = null; if (message.hasText()) { if (message.getText().startsWith(getLanguagesCommand(language))) { sendMessageRequest = onLanguageCommand(message, language); } else if (message.getText().startsWith(getUnitsCommand(language))) { sendMessageRequest = onUnitsCommand(message, language); } else if (message.getText().startsWith(getAlertsCommand(language))) { sendMessageRequest = onAlertsCommand(message, language); } else if (message.getText().startsWith(getBackCommand(language))) { sendMessageRequest = sendMessageDefault(message, language); } else { sendMessageRequest = sendChooseOptionMessage(message.getChatId(), message.getMessageId(), getSettingsKeyboard(language), language); } } return sendMessageRequest; }
Example #18
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 5 votes |
private static SendMessage onForecastWeatherLocation(Message message, String language) { if (message.isReply() && message.hasLocation()) { return onForecastWeatherLocationReceived(message, language); } else { return sendMessageDefault(message, language); } }
Example #19
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 5 votes |
private static SendMessage onNewAlertCommand(Message message, String language) { SendMessage sendMessage = new SendMessage(); sendMessage.enableMarkdown(true); sendMessage.setChatId(message.getChatId()); sendMessage.setReplyMarkup(getRecentsKeyboard(message.getFrom().getId(), language, false)); sendMessage.setText(LocalisationService.getString("chooseNewAlertCity", language)); sendMessage.setReplyToMessageId(message.getMessageId()); DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), ALERTNEW); return sendMessage; }
Example #20
Source File: SendPhoto.java From TelegramBots with MIT License | 5 votes |
@Override public Message deserializeResponse(String answer) throws TelegramApiRequestException { try { ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer, new TypeReference<ApiResponse<Message>>(){}); if (result.getOk()) { return result.getResult(); } else { throw new TelegramApiRequestException("Error sending photo", result); } } catch (IOException e) { throw new TelegramApiRequestException("Unable to deserialize response", e); } }
Example #21
Source File: DefaultAbsSender.java From TelegramBots with MIT License | 5 votes |
@Override public List<Message> execute(SendMediaGroup sendMediaGroup) throws TelegramApiException { assertParamNotNull(sendMediaGroup, "sendMediaGroup"); sendMediaGroup.validate(); try { String url = getBaseUrl() + SendMediaGroup.PATH; HttpPost httppost = configuredHttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setLaxMode(); builder.setCharset(StandardCharsets.UTF_8); builder.addTextBody(SendMediaGroup.CHATID_FIELD, sendMediaGroup.getChatId(), TEXT_PLAIN_CONTENT_TYPE); addInputData(builder, sendMediaGroup.getMedia(), SendMediaGroup.MEDIA_FIELD); if (sendMediaGroup.getDisableNotification() != null) { builder.addTextBody(SendMediaGroup.DISABLENOTIFICATION_FIELD, sendMediaGroup.getDisableNotification().toString(), TEXT_PLAIN_CONTENT_TYPE); } if (sendMediaGroup.getReplyToMessageId() != null) { builder.addTextBody(SendMediaGroup.REPLYTOMESSAGEID_FIELD, sendMediaGroup.getReplyToMessageId().toString(), TEXT_PLAIN_CONTENT_TYPE); } HttpEntity multipart = builder.build(); httppost.setEntity(multipart); return sendMediaGroup.deserializeResponse(sendHttpPostRequest(httppost)); } catch (IOException e) { throw new TelegramApiException("Unable to set chat photo", e); } }
Example #22
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 5 votes |
@Override public void onUpdateReceived(Update update) { try { if (update.hasMessage()) { Message message = update.getMessage(); if (message.hasText() || message.hasLocation()) { handleIncomingMessage(message); } } } catch (Exception e) { BotLogger.error(LOGTAG, e); } }
Example #23
Source File: TelegramBot.java From telegram-notifications-plugin with MIT License | 5 votes |
@Override public void processNonCommandUpdate(Update update) { if (update == null) { LOG.log(Level.WARNING, "Update is null"); return; } final String nonCommandMessage = CONFIG.getBotStrings() .get("message.noncommand"); final Message message = update.getMessage(); final Chat chat = message.getChat(); if (chat.isUserChat()) { sendMessage(chat.getId(), nonCommandMessage); return; } final String text = message.getText(); try { // Skip not direct messages in chats if (text.length() < 1 || text.charAt(0) != '@') return; final String[] tmp = text.split(" "); if (tmp.length < 2 || !CONFIG.getBotName().equals(tmp[0].substring(1, tmp[0].length()))) return; } catch (Exception e) { LOG.log(Level.SEVERE, "Something bad happened while message processing", e); return; } sendMessage(chat.getId(), nonCommandMessage); }
Example #24
Source File: SendInvoice.java From TelegramBots with MIT License | 5 votes |
@Override public Message deserializeResponse(String answer) throws TelegramApiRequestException { try { ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer, new TypeReference<ApiResponse<Message>>(){}); if (result.getOk()) { return result.getResult(); } else { throw new TelegramApiRequestException("Error sending invoice", result); } } catch (IOException e) { throw new TelegramApiRequestException("Unable to deserialize response", e); } }
Example #25
Source File: SendMessage.java From TelegramBots with MIT License | 5 votes |
@Override public Message deserializeResponse(String answer) throws TelegramApiRequestException { try { ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer, new TypeReference<ApiResponse<Message>>(){}); if (result.getOk()) { return result.getResult(); } else { throw new TelegramApiRequestException("Error sending message", result); } } catch (IOException e) { throw new TelegramApiRequestException("Unable to deserialize response", e); } }
Example #26
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 5 votes |
private static SendMessage onAlertsCommand(Message message, String language) { SendMessage sendMessage = new SendMessage(); sendMessage.enableMarkdown(true); sendMessage.setReplyToMessageId(message.getMessageId()); sendMessage.setChatId(message.getChatId()); sendMessage.setReplyMarkup(getAlertsKeyboard(language)); sendMessage.setText(LocalisationService.getString("alertsMenuMessage", language)); DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), ALERT); return sendMessage; }
Example #27
Source File: SendDice.java From TelegramBots with MIT License | 5 votes |
@Override public Message deserializeResponse(String answer) throws TelegramApiRequestException { try { ApiResponse<Message> result = OBJECT_MAPPER.readValue(answer, new TypeReference<ApiResponse<Message>>(){}); if (result.getOk()) { return result.getResult(); } else { throw new TelegramApiRequestException("Error sending dice", result); } } catch (IOException e) { throw new TelegramApiRequestException("Unable to deserialize response", e); } }
Example #28
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 5 votes |
private static SendMessage onForecastWeatherLocationReceived(Message message, String language) { String unitsSystem = DatabaseManager.getInstance().getUserWeatherOptions(message.getFrom().getId())[1]; String weather = WeatherService.getInstance().fetchWeatherForecastByLocation(message.getLocation().getLongitude(), message.getLocation().getLatitude(), message.getFrom().getId(), language, unitsSystem); SendMessage sendMessageRequest = new SendMessage(); sendMessageRequest.enableMarkdown(true); sendMessageRequest.setReplyMarkup(getMainMenuKeyboard(language)); sendMessageRequest.setReplyToMessageId(message.getMessageId()); sendMessageRequest.setText(weather); sendMessageRequest.setChatId(message.getChatId()); DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), MAINMENU); return sendMessageRequest; }
Example #29
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 5 votes |
private static SendMessage messageOnAlert(Message message, String language, int state) { SendMessage sendMessageRequest = null; switch(state) { case ALERT: sendMessageRequest = onAlertOptionSelected(message, language); break; case ALERTNEW: sendMessageRequest = onAlertNewOptionSelected(message, language); break; case ALERTDELETE: sendMessageRequest = onAlertDeleteOptionSelected(message, language); break; } return sendMessageRequest; }
Example #30
Source File: WeatherHandlers.java From TelegramBotsExample with GNU General Public License v3.0 | 5 votes |
private static SendMessage onBackAlertCommand(Message message, String language) { SendMessage sendMessage = new SendMessage(); sendMessage.enableMarkdown(true); ReplyKeyboardMarkup replyKeyboardMarkup = getSettingsKeyboard(language); sendMessage.setReplyMarkup(replyKeyboardMarkup); sendMessage.setReplyToMessageId(message.getMessageId()); sendMessage.setChatId(message.getChatId()); sendMessage.setText(getSettingsMessage(language)); DatabaseManager.getInstance().insertWeatherState(message.getFrom().getId(), message.getChatId(), SETTINGS); return sendMessage; }