W
W
Wynell_ru2020-04-30 16:51:03
Bots
Wynell_ru, 2020-04-30 16:51:03

How to make sequential input in a bot?

There is no language binding here.
Well, here is the question

The essence of the bot: a person clicks on the "start test" button, then the bot asks him in sequence and writes down the answers.
Dialogue example (b - bot, n - user):
B: Hello. Do you want to start? [start button]
P: [presses button]
B: [First question]
P: [First answer]
B: Your answer [First answer] is recorded
[Second question]
P: [Second answer]
...etc

I had an option with a database or "session" variable where, for each user, their answers to questions are recorded, as well as which question they are currently on, to display the next question.

But I tried to implement the option above, and it turned out somehow crooked. Maybe there are easier options?
Still, if it helps, I'm writing a bot in Python via pyTelegramBotAPI

PS The problem is that in addition to testing this, there should be a few more buttons, when pressed, another sequential input starts. That is, simply pushing the increment will not help ...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
nozzy, 2020-04-30
@Wynell_ru

pyTelegramBotAPI just knows how to do step by step and uses files for this. Example:
https://github.com/eternnoir/pyTelegramBotAPI/blob...

I
Ivan Lee, 2020-04-30
@appliks

A sequence of commands can be implemented without a database, but the result needs to be saved somewhere. Telegram will not waste precious bytes on this, so straighten your version. I think the toaster is always happy to help.

T
Timur Pokrovsky, 2020-04-30
@Makaroshka007

Can it be passed to the callback_data button?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question