バージョン: v2.0
目次
LevelRoles
このクラスは、レベルに基づくロール設定を管理します。レベルロールの追加、削除、一覧取得、検索をサポートし、共有 db API を通じて MongoDB と SQLite の両方で動作します。
Methods
Section titled “Methods”LevelRoles.add()
Section titled “LevelRoles.add()”レベルにロールを追加します。対象レベルが既に存在する場合は、指定したロールが統合され、重複は除去されます。
パラメーター
Section titled “パラメーター”| Parameter | Type | Required | Description |
|---|---|---|---|
| guildId | string | ✅ | ギルド ID。 |
| options | LevelRole | ✅ | 追加するレベルとロール。 |
- Promise<
boolean> - 操作が成功した場合はtrue。
XpFatal- 無効なパラメーターが渡された場合。
LevelRoles.delete()
Section titled “LevelRoles.delete()”レベルから一部またはすべてのロールを削除します。options.roles を省略すると、そのレベルのロール全体が削除されます。
パラメーター
Section titled “パラメーター”| Parameter | Type | Required | Description |
|---|---|---|---|
| guildId | string | ✅ | ギルド ID。 |
| options | LevelRole | ✅ | 削除するレベルとロール。 |
- Promise<
boolean> - 操作が成功した場合はtrue。
LevelRoles.deleteAll()
Section titled “LevelRoles.deleteAll()”ギルドに紐づくすべてのレベルロールエントリを削除します。
パラメーター
Section titled “パラメーター”| Parameter | Type | Required | Description |
|---|---|---|---|
| guildId | string | ✅ | ギルド ID。 |
- Promise<
boolean> - 操作が成功した場合はtrue。
LevelRoles.getGuildRoles()
Section titled “LevelRoles.getGuildRoles()”ギルドに設定されたすべてのレベルロールエントリを取得します。
パラメーター
Section titled “パラメーター”| Parameter | Type | Required | Description |
|---|---|---|---|
| guildId | string | ✅ | ギルド ID。 |
- Promise<
LevelRoleResult[]> - レベルロールオブジェクトの配列。
LevelRoles.getUserRoles()
Section titled “LevelRoles.getUserRoles()”ユーザーのレベルに適用されるロール ID を返します。オプションにより、現在レベル、次レベル、前レベルのロールを含めるかを制御できます。既定では現在レベルのみが含まれます。
パラメーター
Section titled “パラメーター”| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | ✅ | ユーザー ID。 |
| guildId | string | ✅ | ギルド ID。 |
| options | GetRolesOptions | ❌ | 次/前レベルを含めるためのオプション。 |
- Promise<
string[]> - ロール ID の配列。該当しない場合は空配列。
LevelRoles.set()
Section titled “LevelRoles.set()”特定レベルのロールを設定し、既存値を上書きします。
パラメーター
Section titled “パラメーター”| Parameter | Type | Required | Description |
|---|---|---|---|
| guildId | string | ✅ | ギルド ID。 |
| options | LevelRole | ✅ | 設定するレベルとロール。 |
- Promise<
boolean> - 操作が成功した場合はtrue。