Answer the question
In order to leave comments, you need to log in
How to make a timer for each user of the bot through the database?
Good afternoon, database via sqlite3
Each user registered in the bot has his own line in the users database
There is a BONUS button in the menu, it should add coins to the balance (it has already been written), but the bonus can only be received by the user once a day
How to implement this?
Answer the question
In order to leave comments, you need to log in
For each user in the database, you need to make a "lastbonus" field and write time.time() there, after importing the module: import time
Next, if the user wants to receive a bonus, then we get the "lastbonus" field from the database and if time.time() - lastbonus > 86400, then we write time.time() there and issue a bonus.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question