jadibot-privacidad.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. let handler = async (m, { conn, usedPrefix, text }) => {
  2. const isSubBot = global.conns?.some(bot => bot.user.jid === m.sender);
  3. const isMainBot = m.sender === global.conn.user.jid;
  4. if (!isSubBot && !isMainBot) return m.reply(await tr('⚠️ Este comando solo puede ser usado por el Bot Principal o un Sub-Bot.'));
  5. const bot = isSubBot ? global.conns.find(bot => bot.user.jid === m.sender) : global.conn;
  6. if (!bot) return m.reply(await tr('⚠️ No se pudo identificar el bot.'));
  7. const botConfig = global.db.data.users[bot.user.jid] || {};
  8. const [option, value] = text.split(' ');
  9. if (!option || !value) {
  10. return m.reply(await tr(`⚠️ Uso: *${usedPrefix}setconfig <opción> <valor>*
  11. Opciones disponibles:
  12. - *privacy*: 1 (activar) / 0 (desactivar)
  13. - *prestar*: 1 (activar) / 0 (desactivar)`));
  14. }
  15. if (option === 'privacy') {
  16. if (value === '1') {
  17. botConfig.privacy = true;
  18. await conn.sendMessage(m.chat, { text: await tr('✅ *Privacidad activada.*\n> Tu número no se mostrará en la lista de bots.') }, { quoted: m });
  19. } else if (value === '0') {
  20. botConfig.privacy = false;
  21. await conn.sendMessage(m.chat, { text: await tr('✅ *Privacidad desactivada.*\n> Tu número se mostrará en la lista de bots.') }, { quoted: m });
  22. } else {
  23. await conn.sendMessage(m.chat, { text: await tr('⚠️ Valor no válido. Usa: *1* (activar) o *0* (desactivar).') }, { quoted: m });
  24. }} else if (option === 'prestar') {
  25. if (value === '1') {
  26. botConfig.prestar = true;
  27. await conn.sendMessage(m.chat, { text: await tr('✅ *Prestar bot activado.*\n> Los usuarios pueden usar el bot para unirlo a grupos.') }, { quoted: m });
  28. } else if (value === '0') {
  29. botConfig.prestar = false;
  30. await conn.sendMessage(m.chat, { text: await tr('✅ *Prestar bot desactivado.*\n> Los usuarios no podrán unir el bot a grupos.') }, { quoted: m });
  31. } else {
  32. await conn.sendMessage(m.chat, { text: await tr('⚠️ Valor no válido. Usa: *1* (activar) o *0* (desactivar).') }, { quoted: m });
  33. }} else {
  34. return m.reply(await tr('⚠️ Opción no válida.'));
  35. }
  36. global.db.data.users[bot.user.jid] = botConfig;
  37. };
  38. handler.command = handler.help = ['setconfig'];
  39. handler.tags = ['jadibot'];
  40. handler.register = true;
  41. export default handler;