{"size": 984, "ext": "js", "max_stars_repo_path": "commands/Economy/leaderboard.js", "max_stars_repo_name": "pherngpy/testing-private-bot-discord.js", "max_stars_repo_stars_event_min_datetime": "2021-03-24T20:23:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T03:47:02.000Z", "max_issues_repo_path": "commands/Economy/leaderboard.js", "max_issues_repo_name": "pherngpy/testing-private-bot-discord.js", "max_issues_repo_issues_event_min_datetime": "2021-04-14T00:25:22.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-03T05:41:10.000Z", "max_forks_repo_path": "commands/Economy/leaderboard.js", "max_forks_repo_name": "pherngpy/testing-private-bot-discord.js", "max_forks_repo_forks_event_min_datetime": "2021-03-25T01:25:36.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-15T06:34:28.000Z"}
{"max_stars_count": 44, "max_issues_count": 4, "max_forks_count": 23, "avg_line_length": 29.8181818182, "max_line_length": 112, "alphanum_fraction": 0.5660569106}
const Discord = require('discord.js')

module.exports = {
  name: 'leaderboard',
  description: 'Display the global leaderboard for economy',
  usage: '',
  aliases: ['lb', 'top'],
  required: [],
  user: [],
  category: __dirname.split("commands\\")[1],

  premium: false,
  guildOnly: false,
  async execute(message, args, client, data) {
    let bals = client.userProfiles
      .array()
      .sort((a, b) => b.balance - a.balance)
      .slice(0, 10)
      .map(async (u, i) => {
        let user = await client.users.fetch(u.user)
        let emoji = i === 0 ? "🥇 " : i === 1 ? "🥈 " : i === 2 ? "🥉 " : ""
        return `${emoji}**${i + 1}.** **${user.tag}** - ${client.emoji.misc.coin} ${u.balance.toLocaleString()}`
      })

    let embed = client.baseEmbed(message, {
      title: `${client.user.username} Economy Leaderboard`,
      description: `${(await Promise.all(bals)).join("\n")}`,
      color: client.colors.gold
    })
    return message.channel.send(embed)

  }
}