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. }