leaderboardバージョン: v2.0
目次
leaderboard()
この関数は、ギルド内の上位ユーザー配列を生成するために使用します。
guildId を省略すると、leaderboard() はすべてのギルドにまたがって各ユーザーの最高 XP エントリを保持し、グローバルランキングを構築します。
パラメーター
Section titled “パラメーター”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| guildId | string | ❌ | ランキング対象のギルド ID。 | |
| limit | number | ❌ | ♾️ | 取得するランキング件数。 |
limit を指定する場合は、0 より大きい正の整数である必要があります。
- Promise<
User[]>
XpFatal- 無効なパラメーターが渡された場合。
[JS] 例
Section titled “[JS] 例”const {leaderboard} = require('simply-xp');
const guildid = "867999056172052551"; // Use undefined for global leaderboardconst limit = 10;
leaderboard(guildid, limit) .then(console.log) // Returns the leaderboard array .catch((err) => console.log(err)); // Returns the error