N
N
Nonoxy2020-11-18 10:33:13
Python
Nonoxy, 2020-11-18 10:33:13

How to implement waiting for the user's response to the bot in the TG?

Hello Guys, I have a problem with the logic of the algorithm, how can I make sure that the program does not proceed to the next step until it completes the step above? I don’t understand how to implement this, from the word at all.
I'm just writing an auto-receiver game for dotka, with a notification in the TG, and partial control through it, I.E. the game was found > a notification comes > I choose to accept / wait and then the bot does what I wrote. But the problem is that when the bot sees the game, it sends a notification and asks a question, but it doesn't care about the answer, because. the program immediately goes further through the code, and since in the variable "whether the game is accepted" (conditionally), according to the standard, the value is "None", he thinks that I refused and just waits.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Krostelev, 2020-11-18
@twistfire92

If you use the pyTelegramBotAPI ( telebot ) library, then use register_next_step_handler
Examples of usage are excellently googled, including a lot of information on this resource

A
Artur Boyun, 2020-11-21
@arturboyun

I advise you to look towards libraries, pyTelegramBotAPI or aiogram

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question