A
A
armadillo-cld2020-07-21 17:48:04
C++ / C#
armadillo-cld, 2020-07-21 17:48:04

How are individual answers made in telegram bots?

Hello.
In general, there was already a similar question, but I did not find the right answer.
For example, when I make a C# bot tg, and write:

bool isNumber = false;
...
if(isNumber) {
bot.SendAsyncTextMessage(id, "вы ввели номер")
}
else if(text.StartsWith("/number")) {
isNumber = true;
bot.SendAsyncTextMessage(id, " Введите номер")
}

And after that, "Enter number" if someone else writes to the bot, then the bot will perceive another message as the entered number.
How can I make it wait for a message only from the user\users who wrote /number, and work as usual for others?

UPD: Maybe try storing user IDs in an array, and then check if the specified user wrote? Not an accordion?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-07-21
@dimonchik2013

UPD: Maybe try storing user IDs in an array, and then check if the specified user wrote? Not an accordion?

paydYod
well, you can still mentally
like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question