roleSetup
This class provides methods to interact with the database. Used for performing operations like creating, updating, deleting, and querying documents.
info
V2 added Role Arrays.
Because of this, we recommend handling both arrays and string for find
and fetch
methods, especially if you have used V2 before.
Methodsβ
roleSetup.add()
β
Adds a role to the role setup.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
client | Client | β | The Discord client. |
guildId | string | β | The guild ID of the role setup. |
options | LevelAddOptions | β | The options for the role setup. |
Returnsβ
- Promise<
boolean
> - If the role was added successfully.
Throwsβ
new Error()
- If an invalid type or value is provided.
roleSetup.find()
β
Finds a role in the role setup.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
guildId | string | β | The guild ID of the role setup. |
level | number | β | The level number of the role setup. |
Returnsβ
- Promise<
{ lvl: number, role: string || string[] }
> - The role setup object.
Throwsβ
new Error()
- If an invalid type or value is provided.
roleSetup.fetch()
β
Lists all level roles in a guild.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
client | Client | β | The Discord client. |
guildId | string | β | The guild ID of the role setup. |
Returnsβ
- Promise<
Array<{ lvl: number, role: string || string[] }>
> - The role setup object.
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 |
---|---|---|---|
client | Client | β | The Discord client. |
guildId | string | β | The guild ID of the role setup. |
options | LevelRemoveOptions | β | The options for the role setup. |
Returnsβ
- Promise<
boolean
> - If the role was removed successfully.
Throwsβ
new Error()
- If an invalid type or value is provided.
LevelAddOptionsβ
Options | Type | Required | Description |
---|---|---|---|
level | number | β | Level to add the role to. |
role | Role ID | β | ID of the role to add. |
LevelRemoveOptionsβ
Options | Type | Required | Description |
---|---|---|---|
level | number | β | Level to remove the roles from. |