H
H
HYZ2021-07-31 14:08:57
Bots
HYZ, 2021-07-31 14:08:57

How to make it so that there is one command, but different answers depending on the previous answer in the Telegram bot?

I am a beginner, so in detail, please, like a grandmother
61085aedd07e7736121486.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2021-07-31
@HYZ

The algorithm for implementing the task is quite simple:

  1. Create a database that will contain the user ID and the number of times that user has entered the command.
  2. When executing a request, read the received file: if the user is not in the database, then write down his id and unit (for the first time), then send him 123. If the user is already in the database, read the current value, and based on it, send the user the desired content (if base is 1, send 456; if 2, send 789, etc.)

The proposed option is not difficult to implement, but in my opinion it will be one of the most reliable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question