CURRENCY NOT DEFINED

Viewed 17

So I'm coding a Currency Discord Bot, and the +daily command won't work. +bal works but when I use +daily it says currency is not definied. Can someone help please?

 if(balance === null) balance = 0
      if(bank === null) bank = 0
        let currency = "<:goldcoin:1021063090646814811>"
        let moneyEmbed = new Discord.MessageEmbed()
        .setTitle(`${message.author.username}'s Balance'`)
        .setDescription(`**Wallet:** ${balance}${currency}\n**Bank:** ${bank}${currency}`)
        .setColor("GREEN")
        .setThumbnail(message.author.displayAvatarURL({dynamic: true}))
        message.channel.send({embeds: [moneyEmbed]})
        }
      
        if(message.content.toLowerCase().startsWith("+daily")) {
        const check = await db.get(`dailyCheck_${message.author.id}`);
        const timeout = 86400000;
        if(check !== null && timeout - (Date.now() - check) > 0) {
        const ms = require("pretty-ms")
        const timeLeft = ms(timeout - (Date.now() - check))
          message.channel.send(`You have already claimed your daily, come back in ${timeLeft}`)
        } else {
          let reward = 1000
          let currentBalance = await db.get(`wallet_${message.author.id}`)
          message.channel.send(`You claimed ${reward.toLocaleString()}${currency} as your daily reward! Come back in ${timeLeft}!`)
          
          await db.set(`wallet_${message.author.id}`, currentBalance + reward)
          await db.set(`dailyCheck_${message.author.id}`, Date.now())
        }
      }
0 Answers
Related