Actualmente estoy tratando de hacer un enfriamiento, el código no es mío, pero me gustaría entender por qué recibo este error y me pregunto cómo solucionarlo.
const cooldowns = new Map(); if(cooldowns.has(command.name)) { cooldowns.set(command.name, new Discord.Collection()) } const current = Date.now() const time_stamps = cooldowns.get(command.name) const cooldown = (command.cooldown) * 1000; if(time_stamps.has(message.author.id)) { const expiration = time_stamps.get(message.author.id) + cooldown if(current < expiration) { const time = (expiration - current) / 1000; return message.reply("message") } } time_stamps.set(message.author.id, current); setTimeout(() => time_stamps.delete(message.author.id), cooldown);Error:
if(time_stamps.has(message.author.id)) { ^ TypeError: Cannot read properties of undefined (reading 'has')