-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaderboard.js
22 lines (19 loc) · 988 Bytes
/
leaderboard.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const { MessageEmbed } = require("discord.js");
exports.execute = async (client, message, args) => {
let leaderboard = client.eco.leaderboard({ limit: 15, raw: false });
if (!leaderboard || leaderboard.length < 1) return message.channel.send("❌ | Empty Leaderboard!");
const embed = new MessageEmbed()
.setAuthor(`Leaderboard of ${message.guild.name}!`, message.guild.iconURL)
.setColor("RANDOM")
.setThumbnail(client.users.cache.get(leaderboard[0].id) ? client.users.cache.get(leaderboard[0].id).displayAvatarURL : "https://cdn.discordapp.com/avatars/603948445362946084/a_f61398e073d78ae104e32b0517c891c3.gif")
.setTimestamp();
leaderboard.forEach(u => {
embed.addField(`${u.position}. ${client.users.cache.get(u.id) ? client.users.cache.get(u.id).tag : "Unknown#0000"}`, `${u.money} 💸`);
});
return message.channel.send(embed);
}
exports.help = {
name: "lb",
aliases: ["leaderboard"],
usage: `lb`
}