rpg-banc.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const handler = async (m, {conn, command, args}) => {
  2. let who;
  3. if (m.isGroup) who = m.mentionedJid[0] ? m.mentionedJid[0] : m.sender;
  4. else who = m.sender;
  5. let users = global.db.data.users[m.sender];
  6. if (command == 'dep' || command == 'depositar') {
  7. if (!args[0]) return m.reply(`[ ⚠️ ] *Ingresa la cantidad para agregar a sus cuenta bancaria*`);
  8. if (args[0] == '--all') {
  9. let count = parseInt(users.limit);
  10. users.limit -= count * 1
  11. users.banco += count * 1
  12. await m.reply(`*[ 🏦 ] Has agregados.*`);
  13. return !0;
  14. };
  15. if (!Number(args[0])) return m.reply(`[ ⚠️ ] *Falto en número de cantidad de diamante 💎*`);
  16. let count = parseInt(args[0]);
  17. if (!users.limit) return m.reply(`*Esta pobre no tener suficiente diamante*`);
  18. if (users.limit < count) return m.reply(`*Che no sabes cuanto dinero tiene el tu cartera? usar el comando:* #bal`);
  19. users.limit -= count * 1;
  20. users.banco += count * 1;
  21. await m.reply(`*[ 🏦 ] Has ingresando ${count} diamante al Banco*`)}
  22. if (command == 'retirar' || command == 'toremove') {
  23. let user = global.db.data.users[m.sender]
  24. if (!args[0]) return m.reply(`[ ⚠️ ] *ingresa la cantidad a retirar*`);
  25. if (args[0] == '--all') {
  26. let count = parseInt(user.banco);
  27. user.banco -= count * 1
  28. user.limit += count * 1
  29. await m.reply(`*[ 🏦 ] Retiraste (${count}) diamante 💎 del Banco.*`);
  30. return !0
  31. }
  32. if (!Number(args[0])) return m.reply(`La cantidad debe ser un mumero`);
  33. let count = parseInt(args[0]);
  34. if (!user.banco) return m.reply(`Hey fantasma 👻, no tener esa cantidad de dinero el banco 🥲`);
  35. if (user.banco < count) return m.reply(`*Che no sabes cuanto dinero tiene el tu cartera? usar el comando:* #bal`);
  36. user.banco -= count * 1
  37. user.limit += count * 1
  38. await m.reply(`*[ 🏦 ] Has Retirado (${count}) dinero del Banco*`)}
  39. }
  40. handler.help = ['dep', 'retirar']
  41. handler.tags = ['econ']
  42. handler.command = /^(dep|depositar|retirar|toremove)$/i
  43. handler.register = true
  44. export default handler