rpg-daily.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. const free = 5000
  2. const prem = 20000
  3. let handler = async (m, {conn, isPrems }) => {
  4. let time = global.db.data.users[m.sender].lastclaim + 86400000
  5. if (new Date - global.db.data.users[m.sender].lastclaim < 86400000) throw `⚠️ 𝙔𝙖 𝙧𝙚𝙘𝙡𝙖𝙢𝙖𝙨𝙩𝙚 𝙩𝙪 𝙧𝙚𝙜𝙖𝙡𝙤 🎁\n𝙑𝙪𝙚𝙡𝙫𝙚 𝙚𝙣 *${msToTime(time - new Date())}* 𝙋𝙖𝙧𝙖 𝙫𝙤𝙡𝙫𝙚𝙧 𝙖 𝙧𝙚𝙘𝙡𝙖𝙢𝙖𝙧*`
  6. const limit = Math.floor(Math.random() * 30)
  7. const money = Math.floor(Math.random() * 800)
  8. global.db.data.users[m.sender].limit += limit;
  9. global.db.data.users[m.sender].money += money
  10. global.db.data.users[m.sender].exp += isPrems ? prem : free
  11. m.reply(`🎁 *𝙊𝙗𝙩𝙞𝙚𝙣𝙚 𝙪𝙣 𝙧𝙚𝙜𝙖𝙡𝙤!!*
  12. 🔸 *𝐇𝐀𝐒 𝐑𝐄𝐂𝐈𝐁𝐈𝐃𝐎:*
  13. *💎 Diamante:* ${limit}
  14. *🪙 KantuCoins:* ${money}
  15. *🆙 Xp:* ${isPrems ? prem : free}`)
  16. global.db.data.users[m.sender].lastclaim = new Date * 1
  17. }
  18. handler.help = ['daily']
  19. handler.tags = ['econ']
  20. handler.command = ['daily', 'claim']
  21. handler.register = true
  22. export default handler
  23. function msToTime(duration) {
  24. var milliseconds = parseInt((duration % 1000) / 100),
  25. seconds = Math.floor((duration / 1000) % 60),
  26. minutes = Math.floor((duration / (1000 * 60)) % 60),
  27. hours = Math.floor((duration / (1000 * 60 * 60)) % 24)
  28. hours = (hours < 10) ? "0" + hours : hours
  29. minutes = (minutes < 10) ? "0" + minutes : minutes
  30. seconds = (seconds < 10) ? "0" + seconds : seconds
  31. return hours + " Horas " + minutes + " Minutos"
  32. }