Discord.js将命令限制为每天5次

时间:2020-05-02 01:43:59

标签: node.js discord

我有以下命令,我希望限制用户每24小时只能使用5次

if(command === "rep") {
  let user = message.mentions.members.first();
  console.log(`[.] ${message.author.username} issued command "rep"`.cyan)
  let amount = 1
  console.log(`[+] ${message.author.username} repped ${user}`.green)
  db.add(`karma_${user.id}`, amount)
  let bal = await db.fetch(`karma_${user.id}`)
  let embed = new Discord.MessageEmbed()
  .setColor(0x3242a8)
  .setTitle("TD Karma Bank")
  .addField("User Repped", `${message.author.username} has repped ${user}!`, true)
  .addField("New Balance", `${user} now has ${bal} karma points!`, true)
  .setFooter("This bot was created by Yote.", "https://cdn.discordapp.com/icons/458377279349719073/a_f6b59ba4feb6fc0d7f1b47d659d85091.webp?size=128")
  message.channel.send(embed)
}

不知道如何执行此操作,有任何可能的帮助吗?

0 个答案:

没有答案