M
M
mike1532017-02-23 16:20:06
Java
mike153, 2017-02-23 16:20:06

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

2 answer(s)
S
Stanislav Kudelko, 2017-02-23
@mike153

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.

P
Polina, 2019-12-20
Mezenina @medigi27

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 you have that problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question