{"size": 820, "ext": "js", "max_stars_repo_path": "commands/bank/balance.js", "max_stars_repo_name": "ArcLight4/lightbot", "max_stars_repo_stars_event_min_datetime": "2018-08-12T21:29:29.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-15T19:04:32.000Z", "max_issues_repo_path": "commands/bank/balance.js", "max_issues_repo_name": "ArcLight4/lightbot", "max_issues_repo_issues_event_min_datetime": "2018-12-25T22:36:06.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-12T22:15:53.000Z", "max_forks_repo_path": "commands/bank/balance.js", "max_forks_repo_name": "ArcLight4/lightbot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 10, "max_forks_count": null, "avg_line_length": 28.275862069, "max_line_length": 75, "alphanum_fraction": 0.5}
let User = require('../../models/user.model')

module.exports = (msg, prefix, args, db) => {
  let regex = /<@!?(\d+)>/

    if(regex.test(msg.content)){

      if(msg.guild.members.find('id', regex.exec(msg.content)[1])){
        let user = msg.guild.members.find('id', regex.exec(msg.content)[1])
        
        User.findOne(
          { userID: user.id, guildID: msg.guild.id },
          (err, doc) => {
            if (err) {
              msg.channel.send('There is no account for this user')
              console.error(err)
            } else {
              msg.channel.send(`Available balance : \`${doc.balance}\``)
            }
          }
        )

      } else {
        msg.channel.send('You must enter a valid user tag')
      }
    } else {
      msg.channel.send('You must enter a user tag')
    }
}