Aller au contenu
Version: v1.4
Sur cette page

leaderboard()

Ce contenu n’est pas encore disponible dans votre langue.

This function is used to generate an array of the top users in a guild.

Parameter Type Required Default Description
client Client ✅ The client object.
guildId string ✅ The Guild ID
limit number ❌ ♾️ The limit of the leaderboard.
  • Promise<object[]>

Example:

[
{
guildID: "867999056172052551",
userID: "123456789012345",
level: 21,
xp: 4410,
shortxp: "4.41k",
position: 1, // considered as "rank"
username: "abadima",
tag: "abadima#0",
},
// etc
]
  • new Error() - if the guild ID is missing, or the guild is not in the client’s cache (Guild was not found).
const { leaderboard } = require("simply-xp");
const guildId = "867999056172052551";
const limit = 10;
leaderboard(client, guildId, limit)
.then(console.log) // Returns the leaderboard array
.catch((err) => console.log(err)); // Returns the error