{"size": 1070, "ext": "js", "max_stars_repo_path": "plugins/registrar.js", "max_stars_repo_name": "LordArthurxD/yolo", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "plugins/registrar.js", "max_issues_repo_name": "LordArthurxD/yolo", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "plugins/registrar.js", "max_forks_repo_name": "LordArthurxD/yolo", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.7222222222, "max_line_length": 132, "alphanum_fraction": 0.5794392523}
const { createHash } = require('crypto')
let Reg = /(.*)([.|])([0-9]*)$/i
let handler = async function (m, { text, usedPrefix }) {
  let user = global.DATABASE._data.users[m.sender]
  if (user.registered === true) throw `Usted ya está registrado\nQuiere volver a registrarse? ${usedPrefix}unreg <SN|SERIAL NUMBER>`
  if (!Reg.test(text)) throw `Foemat está mal\n*${usedPrefix}registrar <nombre>.edad>*`
  let [_, name, splitter, age] = text.match(Reg)
  if (!name) throw 'El nombre no puede estar vacío'
  if (!age) throw 'La edad no puede estar vacía'
  user.name = name
  user.age = parseInt(age)
  user.regTime = + new Date
  user.registered = true
  let sn = createHash('md5').update(m.sender).digest('hex')
  m.reply(`
╔══════════════╗
║  ঔৣ͜͡‎⛤⃖͢ঔৣ͜͡‎⛤⃖͢ᴍᴋ-ʙᴏᴛঔৣ͜͡‎⛤⃖͢ঔৣ͜͡‎⛤⃖͢
║╔═══════════════╗
║║>>🅁🄴🄶🄸🅂🅃🅁🄰🄳🄾<<
║╚╗
║ ║𝐍𝐨𝐦𝐛𝐫𝐞: ${name}
║ ║𝐄𝐝𝐚𝐝: ${age}
║ ║𝐒𝐞𝐫𝐢𝐚𝐥: ${sn}
║╔╝
║╚═══════════════╝
╚══════════════╝
`.trim())
}
handler.help = ['registrar <nombre>.<edad>']
handler.tags = ['exp']

handler.command = /^(registrar|reg(ister)?)$/i

module.exports = handler

