我正在尝试制作一款采矿迷你游戏,
我希望用户输入/mine 2h 2m 2s
之类的命令,然后bot会进行挖掘,并且用户在提到的挖掘时间内不能使用该命令
我将整个时间都转换为ms,但所有内容我都无法弄清楚如何使漫游器停止用户在该时间内使用命令
我试图做出设定,无法弄清楚。
const talkedRecently = new Set();
if (talkedRecently.has(message.author.id)) {
const minecooldown = new Discord.MessageEmbed()
.setTitle('Mine')
.setColor(config.error)
.setDescription(`You are already mining for ${args[0]} ${args[1]} ${args[2]}`)
message.channel.send(minecooldown)
} else {
//command here (converting time to milliseconds)
}
talkedRecently.add(message.author.id);
setTimeout(() => {
// Removes the user from the set after a minute
talkedRecently.delete(message.author.id);
}, );