Answer the question
In order to leave comments, you need to log in
How to get a timestamp and delete a row from the database, with the condition that the current time is greater than the specified one?
Hello! Please help me figure it out, I'm confused.
The sequelize module is used to work with the database.
So, there is some function to unlock the user. unban is a column that is timestamped from when the user was unbanned.
Task: need to delete a row if the current time is greater than the time in the unban column.
async function checkUnbans(bot){
console.log('timer is working');
let ban = await Ban.findOne({where: {
unban: {
$lte: new Date().getTime()+1
}
}});
if(ban) {
await ban.destroy();
await bot.sendMessage(ban.chat_id, " Вы разблокированы в боте!");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question