Answer the question
In order to leave comments, you need to log in
How to add a countdown to the bot?
I need the bot to answer ready when the /go command is pressed for the first time, but when this command is pressed again, it writes how much time is left (counting 3 hours from the first press), for example (2 hours 59 minutes left). When 3 hours have passed and press the /go command, it will write again ready and start counting 3 hours.
Do you need to connect the database for this or is it possible to do it simply in the code?
Answer the question
In order to leave comments, you need to log in
You can use the state machine of the aiogram library itself. Lots of educational material. The question is where to store these states. There is the easiest way - in RAM, but when you restart the bot, everything will be erased.
If you do not want to bother much, then IMHO the easiest way is a database. Time in UNIX format comes in the message object itself, and you should be tied to it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question