Version: v1.4
On this page
roleSetup
This class provides methods to manage the level roles of a guild: the roles users are given when they reach a level.
Methods
Section titled “Methods”roleSetup.add()
Section titled “roleSetup.add()”Adds a role to the role setup. A level can have more than one role.
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<
true> - If the role was added.
Throws
Section titled “Throws”new Error()- If the role is not a role of the guild (Role ID is invalid), or that level and role were already added (Level Already Exist. Use delete).
roleSetup.find()
Section titled “roleSetup.find()”Finds the roles set for a level.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| client | Client | ✅ | The Discord client. |
| guildId | string | ✅ | The guild ID of the role setup. |
| level | number | string | ✅ | The level of the role setup. |
Returns
Section titled “Returns”- Promise<
{ lvl: number | string, role: string }[] | undefined> - The entries for that level, orundefinedif the guild has no level roles.
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<
{ lvl: number | string, role: string }[] | undefined> - Every entry, orundefinedif the guild has no level roles.
roleSetup.remove()
Section titled “roleSetup.remove()”Removes every role set for a level.
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<
true> - If the roles were removed.
Throws
Section titled “Throws”new Error()- If no role is set for that level (Level role with this level does not exist).
LevelAddOptions
Section titled “LevelAddOptions”| Options | Type | Required | Description |
|---|---|---|---|
| level | number | string | ✅ | 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 | string | ✅ | Level to remove the roles from. |