V
V
veehron2021-10-26 23:22:59
Python
veehron, 2021-10-26 23:22:59

How to make the bot wait for a message from the user who sent the command?

The bot is in a group. For example, I sent a command and the bot is waiting for the next message, but another user sent a message to the chat and it turns out that he recorded his message. As a result: the bot should listen to the sender of the command.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Ananchenko, 2021-10-27
@veehron

Check message.from_user.id if you ignore different if you continue with the same

V
Vindicar, 2021-10-27
@Vindicar

Well, obviously, the bot should remember which users entered the command, and if the message is not from one of them, then ignore this message and wait again.
On the other hand, think - maybe you can get away from this system with 100500 messages altogether, and get by with command parameters?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question