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