Answer the question
In order to leave comments, you need to log in
How to get response to Telegram bot java message?
I can't figure out how to get a reply to a message. Example:
User enters: /help
Bot replies: Enter your name:
User replies: Vasya //I don't understand here, How to count the answer?
Bot replies: Thank you!
I don't use webhook.
I send requests through the library: https://github.com/pengrad/java-telegram-bot-api
Answer the question
In order to leave comments, you need to log in
Also when I started, I solved the same problem. You can solve it by prefixing the command. Let's say the bot writes:
Hello! Please enter your name like this: name Vasya.
Then you check each message for a prefix. If there is, discard it and take the name.
I downloaded the same lib, but there, in the example, classes are used that are not in it.
For example, these:
import org.telegram.telegrambots.meta.logging.BotLogger;
import org.telegram.telegrambots.meta.logging.BotsFileHandler;
import org.telegram.updateshandlers.*;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question