leaderboardVersion: v1.4
目次
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: "867999056172052551", userID: "123456789012345", level: 21, xp: 4410, shortxp: "4.41k", position: 1, // considered as "rank" username: "abadima", tag: "abadima#0", }, // etc]Throws
Section titled “Throws”new Error()- if the guild ID is missing, or the guild is not in the client’s cache (Guild was not found).
[JS] Example
Section titled “[JS] Example”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