//Above execute
const cooldowns = new Map();
//After execute
const current_time = Date.now();
console.log(cooldowns)
console.log(current_time)
const time_stamps = cooldowns.get(interaction.commandName);
console.log(time_stamps)
const cooldown_amount = (interaction.cooldown) * 3600000;
if(time_stamps.has(interaction.user.id)){
const expiration_time = time_stamps.get(interaction.user.id) + cooldown_amount;
console.log(expiration_time)
if(current_time < expiration_time){
const time_left = Duration(expiration_time - Date.now(), { units: ['h', 'm', 's'], round:true })
console.log(time_left)
}
}
//If the author's id is not in time_stamps then add them with the current time.
time_stamps.set(interaction.user.id, current_time);
//Delete the user's id once the cooldown is over.
setTimeout(() => time_stamps.delete(interaction.user.id), cooldown_amount);
//Above execute
const cooldowns = new Map();
//After execute
const current_time = Date.now();
console.log(cooldowns)
console.log(current_time)
const time_stamps = cooldowns.get(interaction.commandName);
console.log(time_stamps)
const cooldown_amount = (interaction.cooldown) * 3600000;
if(time_stamps.has(interaction.user.id)){
const expiration_time = time_stamps.get(interaction.user.id) + cooldown_amount;
console.log(expiration_time)
if(current_time < expiration_time){
const time_left = Duration(expiration_time - Date.now(), { units: ['h', 'm', 's'], round:true })
console.log(time_left)
}
}
//If the author's id is not in time_stamps then add them with the current time.
time_stamps.set(interaction.user.id, current_time);
//Delete the user's id once the cooldown is over.
setTimeout(() => time_stamps.delete(interaction.user.id), cooldown_amount);