Answer the question
In order to leave comments, you need to log in
I don't know how to save the answer in the Telegram bot (aiogram)?
I want the user to ask a question to the bot, like "What are you doing?"
In response, he receives "The bot is working hard to please the user, but what are you doing?"
And I need the answer of the bot "Keep up the good work" (exactly the next one) to any next answer, since I have a link to the help on incomprehensible lines.
The code below
is elif message.text.lower() == 'what are you doing?':
await bot.send_message(message.chat.id, 'The bot is working hard to please the user, what are you doing?')
elif message.text. lower () == '':
await bot.send_message(message.chat.id, 'Keep up the good work')
Answer the question
In order to leave comments, you need to log in
Store the user state either in the database or in memory (depending on the final task) as a simple key-value, where the key is the user id and the value is the current step in the bot. When checking an incoming message, also check the user's step in the bot.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question