Answer the question
In order to leave comments, you need to log in
Mut command example?
Is there an example of a mut command with a database? I created a user id and a column with the time of the mute in the database, but I don’t understand how to make the timer go and check all this, and also check it when restarting.
Answer the question
In order to leave comments, you need to log in
On the command to issue a mut, enter the user ID and the time when you need to remove the mut into the database table.
Also, periodically (say, once every few minutes), select from this table all records whose unmuting time is less than the current time. If such entries are found, you unmute the users they belong to and delete those entries.
Such a scheme survives the restart of the bot without the need for additional gestures.
How to make a periodic task depends on the language and library used - you didn't specify them, by the way. But it can be done in any language.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question