Aller au contenu
Sur cette page

LevelRoles

Ce contenu n’est pas encore disponible dans votre langue.

This class manages level-based role setups. It supports adding, removing, listing and querying level roles and works with both MongoDB and SQLite backends via the shared db API.

Adds roles to a level. If the level already exists the provided roles are merged (duplicates removed).

Parameter Type Required Description
guildId string ✅ The guild ID.
options LevelRole ✅ The level and roles to add.
  • Promise<boolean> - true if the operation succeeded.
  • XpFatal - If invalid parameters are provided.

Deletes some or all roles from a level. When options.roles is omitted all roles for the level are removed.

Parameter Type Required Description
guildId string ✅ The guild ID.
options LevelRole ✅ The level and roles to remove.
  • Promise<boolean> - true if the operation succeeded.

Deletes all level-role entries for a guild.

Parameter Type Required Description
guildId string ✅ The guild ID.
  • Promise<boolean> - true if the operation succeeded.

Fetches all level-role entries for a guild.

Parameter Type Required Description
guildId string ✅ The guild ID.

Returns role IDs applicable to a user’s level. Options control whether roles for the current, next or previous levels are included. By default only the current level is included.

Parameter Type Required Description
userId string ✅ The user ID.
guildId string ✅ The guild ID.
options GetRolesOptions ❌ Options to include next/prev.
  • Promise<string[]> - Array of role IDs (or empty array).

Sets (overwrites) the roles for a specific level.

Parameter Type Required Description
guildId string ✅ The guild ID.
options LevelRole ✅ The level and roles to set.
  • Promise<boolean> - true if the operation succeeded.