Answer the question
In order to leave comments, you need to log in
How can a telegram bot (Java TelegramBots) accept a response to its message?
When you enter the /start command, the bot sends a message and waits until I send him another one.
public class Bot extends TelegramLongPollingBot {
private long chatId;
Parser parser = new Parser();
public void onUpdateReceived(Update update) {
update.getUpdateId();
chatId = update.getMessage().getChatId();
String text = update.getMessage().getText();
if(text.equals("/start") || text.equals("/Start")) {
SendMessage sendMessage = new SendMessage().setChatId(chatId);
try {
sendMessage.setText("Введите URL");
execute(sendMessage);
}
catch(TelegramApiException e){
e.printStackTrace();
}
}
}
public String getBotUsername(){
return "@ParseSteamBot";
}
@Override
public String getBotToken() {
return "872707712:AAG1DC5si0qXLVBDyrD49HRGn-Co6bZ4xa0";
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question