Version: v1.3
On this page
roleSetup
This class provides methods to interact with the database. Used for performing operations like creating, updating, deleting, and querying documents.
Methods
Section titled “Methods”roleSetup.add()
Section titled “roleSetup.add()”Adds a role to the role setup.
Parameters
Section titled “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
Section titled “Returns”- Promise<
boolean> - If the role was added successfully.
Throws
Section titled “Throws”new Error()- If an invalid type or value is provided.
roleSetup.find()
Section titled “roleSetup.find()”Finds a role in the role setup.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| guildId | string | ✅ | The guild ID of the role setup. |
| level | number | ✅ | The level number of the role setup. |
Returns
Section titled “Returns”- Promise<
{ lvl: number, role: string || string[] }> - The role setup object.
Throws
Section titled “Throws”new Error()- If an invalid type or value is provided.
roleSetup.fetch()
Section titled “roleSetup.fetch()”Lists all level roles in a guild.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| client | Client | ✅ | The Discord client. |
| guildId | string | ✅ | The guild ID of the role setup. |
Returns
Section titled “Returns”- Promise<
Array<{ lvl: number, role: string || string[] }>> - The role setup object.
Throws
Section titled “Throws”XpFatal- If there are no level roles in the guild.
roleSetup.remove()
Section titled “roleSetup.remove()”Removes a role from the role setup.
Parameters
Section titled “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
Section titled “Returns”- Promise<
boolean> - If the role was removed successfully.
Throws
Section titled “Throws”new Error()- If an invalid type or value is provided.
LevelAddOptions
Section titled “LevelAddOptions”| Options | Type | Required | Description |
|---|---|---|---|
| level | number | ✅ | Level to add the role to. |
| role | Role ID | ✅ | ID of the role to add. |
LevelRemoveOptions
Section titled “LevelRemoveOptions”| Options | Type | Required | Description |
|---|---|---|---|
| level | number | ✅ | Level to remove the roles from. |