leaderboardVersion: v1.3
目次
leaderboard()
このコンテンツはまだ日本語訳がありません。
This function is used to generate an array of the top users in a guild.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| client | Client | ✅ | The client object. | |
| guildID | string | ✅ | The Guild ID | |
| limit | number | ❌ | ♾️ | The limit of the leaderboard. |
Returns
Section titled “Returns”- Promise<
object[]>
Example:
[ { guildID: "123456789", userID: "123456789012345", level: 69, xp: 476100, position: 1, // considered as "rank" username: "Abadima", tag: "Abadima#6356", shortxp: 476k, }, // etc]Throws
Section titled “Throws”new Error()- if invalid parameters are provided, or guild is not found.
[JS] Example
Section titled “[JS] Example”const {leaderboard} = require('simply-xp');
const guildid = "867999056172052551"; // Use undefined for global leaderboardconst limit = 10;
leaderboard(client, guildid, limit) .then(console.log) // Returns the leaderboard array .catch((err) => console.log(err)); // Returns the error