所以对于我的日常命令,我希望有个连胜。例如,在第1天,您的连胜数为0,在第2天,您的连胜数为1,您又赚了10个硬币。现在,如果您在24小时后不使用该命令,则会失去连胜。例如,在第2天,您每天做一次;在4/23/19上每天做一次,因此在第3天,您忘记做;在每天4/25/19上每天做一次,您失去了整个条纹!从头开始。
这是当前代码,但我不知道如何制作条纹
run: async (client, message, args) => {
if (message.channel.type == "dm") return;
if(!balance[message.author.id]){
balance[message.author.id] = {
balance: 0
};
}
let curcoins = balance[message.author.id].balance;
let cooldown = 8.64e+7,
amount = 100
let lastdaily = await db.fetch(`lastDaily_${message.author.id}`)
if (lastdaily !== null && cooldown - (Date.now() - lastdaily) > 0) {
let timeObj = ms(cooldown - (Date.now() - lastdaily))
let cEmbed = new MessageEmbed()
.setColor("RANDOM")
.setTitle("Slow down, cmon!")
.setDescription(`You have to wait \`${timeObj.hours} hours, ${timeObj.minutes} minutes and ${timeObj.seconds} seconds\` to collect your daily coins again!\n\nWhile you wait why not follow our [Twitter](https://twitter.com/switchoffical)`)
message.channel.send(cEmbed)
} else {
db.set(`lastDaily_${message.author.id}`, Date.now());
balance[message.author.id].balance = curcoins + amount;
fs.writeFile("././database/balance.json", JSON.stringify(balance, null, 2), (err) => {
let dEmbed = new MessageEmbed()
.setColor("RANDOM")
.setTitle(`Here are your daily coins, ${message.author.username}`)
.setDescription(`**${amount} coins** were placed in your wallet!`)
message.channel.send(dEmbed);
})
}
}
}