Skip to main content

roleSetup

This class provides methods to interact with the database. Used for performing operations like creating, updating, deleting, and querying documents.

Methods​

roleSetup.add()​

Adds a role to the role setup.

Parameters​

ParameterTypeRequiredDescription
guildIdstringβœ…The guild ID of the role setup.
optionsRoleSetupObjectβœ…The options for the role setup.

Returns​

  • Promise<boolean> - If the role was added successfully.

Throws​

  • XpFatal - If an invalid type or value is provided.

roleSetup.getRoles()​

Gets the roles of user's current level, with options to include more roles.

Parameters​

ParameterTypeRequiredDescription
userIdstringβœ…The ID of the user.
guildIdstringβœ…The guild ID.
optionsGetRolesOptions❌The options for the role setup.

Returns​

  • Promise<string[]> - The roles of the user (or empty array if none).

Throws​

  • XpFatal - If invalid parameters are provided.

roleSetup.find()​

Finds a role in the role setup.

Parameters​

ParameterTypeRequiredDescription
guildIdstringβœ…The guild ID of the role setup.
levelNumbernumberβœ…The level number of the role setup.

Returns​

Throws​

  • XpFatal - If an invalid type or value is provided.

roleSetup.list()​

Lists all level roles in a guild.

Parameters​

ParameterTypeRequiredDescription
guildIdstringβœ…The guild ID of the role setup.

Returns​

Throws​

  • XpFatal - If there are no level roles in the guild.

roleSetup.remove()​

Removes a role from the role setup.

Parameters​

ParameterTypeRequiredDescription
guildIdstringβœ…The guild ID of the role setup.
levelNumbernumberβœ…The level number of the role setup.

Returns​

  • Promise<boolean> - If the role was removed successfully.

Throws​

  • XpFatal - If an invalid type or value is provided.