From 87e3f23e8ed49ca5f790ecf6cdb0714d57bbdc2c Mon Sep 17 00:00:00 2001 From: Dmitry Gangan <42858651+dgangan@users.noreply.github.com> Date: Fri, 12 Mar 2021 22:08:18 +0200 Subject: [PATCH] Update Getting-Started.md In latest release of TelegramBots SendMessage class methods setChatId(String chatId) and setText(String text) are returning void - hence cannot be chained on SendMessage constructor Also, getChatId() is returning Long, rather than String, hence it should be converted to String while used in setChatId(String chatId) --- TelegramBots.wiki/Getting-Started.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md index 2759079a..21970470 100644 --- a/TelegramBots.wiki/Getting-Started.md +++ b/TelegramBots.wiki/Getting-Started.md @@ -84,9 +84,10 @@ Now that we have the library, we can start coding. There are few steps to follow public void onUpdateReceived(Update update) { // We check if the update has a message and the message has text if (update.hasMessage() && update.getMessage().hasText()) { - SendMessage message = new SendMessage() // Create a SendMessage object with mandatory fields - .setChatId(update.getMessage().getChatId()) - .setText(update.getMessage().getText()); + SendMessage message = new SendMessage(); // Create a SendMessage object with mandatory fields + message.setChatId(update.getMessage().getChatId().toString()); + message.setText(update.getMessage().getText()); + try { execute(message); // Call method to send the message } catch (TelegramApiException e) {