I have a discord bot with a mongodb database.
He has a moderation commands, in this case a mute command. Each time a moderator mutes a member, the member receives a «muted» role and value of mute in the database equal to the current UNIX time + seconds of the mute time. Then, in the main file when I start the application, I create timers (setInterval ()), which once a minute query the database and check if the current time is longer than the time in the database. If so, the participant is removed from the role of mute and the value is reset.
Question: Is this a good practice? How can you do better? (I do not consider the option of starting the setTimeout () timer after issuing a punishment, because in this case, when the application is restarted, the participant will never be unmuted)
Thank!