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β
Parameter | Type | Required | Description |
---|---|---|---|
guildId | string | β | The guild ID of the role setup. |
options | RoleSetupObject | β | 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β
Parameter | Type | Required | Description |
---|---|---|---|
userId | string | β | The ID of the user. |
guildId | string | β | The guild ID. |
options | GetRolesOptions | β | 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β
Parameter | Type | Required | Description |
---|---|---|---|
guildId | string | β | The guild ID of the role setup. |
levelNumber | number | β | The level number of the role setup. |
Returnsβ
- Promise<
RoleSetupObject
> - The role setup object.
Throwsβ
XpFatal
- If an invalid type or value is provided.
roleSetup.list()
β
Lists all level roles in a guild.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
guildId | string | β | The guild ID of the role setup. |
Returnsβ
- Promise<
RoleSetupObject
[]> - The role setup objects.
Throwsβ
XpFatal
- If there are no level roles in the guild.
roleSetup.remove()
β
Removes a role from the role setup.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
guildId | string | β | The guild ID of the role setup. |
levelNumber | number | β | 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.