cooldown js code example

Example: super cooldown discord.js

If you create an object of cooldowns you can get how much time they would have left by subtracting the date from the cooldown.
Like so:
//Start of code or something
var cooldowns = {}
var minute = 60000;
var hour = minute * 24;
//Set cooldown
cooldowns[message.author.id] = Date.now() + hour * 24; //Set a 24 hour cooldown
//At command check
if(cooldowns[message.author.id]){
if(cooldowns[message.author.id] > Date.now()) delete cooldowns[message.author.id];
else console.log("user still has " + Math.round((cooldowns[message.author.id] - Date.now)/minute) + " minutes left")
}