{"size": 628, "ext": "js", "max_stars_repo_path": "src/commands/top.js", "max_stars_repo_name": "Wifsimster/discord-d-d", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/commands/top.js", "max_issues_repo_name": "Wifsimster/discord-d-d", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/commands/top.js", "max_forks_repo_name": "Wifsimster/discord-d-d", "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": 26.1666666667, "max_line_length": 87, "alphanum_fraction": 0.5796178344}
const Discord = require('discord.js')
const User = require('../models/user')

module.exports = {
  name: 'top',
  description: 'Top',
  usage: '[commande name]',
  cooldown: 5,
  async execute(message) {
    let users = await User.findAll({ order: [['experience', 'DESC']] })
    
    if(users) {      
      let messageEmbed = new Discord.MessageEmbed()
        .setColor('#0099ff')
        .setTitle('Leaderboard (Experience)')
      
      users.map((user, index) => {
        messageEmbed.addField(`${index + 1}.${user.username}`, `${user.experience} XP`)
      })  

      message.channel.send(messageEmbed)    
    }
  }
}