Aller au contenu principal
Version: v1

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

ParameterTypeRequiredDescription
clientClientThe Discord client.
guildIdstringThe guild ID of the role setup.
optionsLevelAddOptionsThe 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

ParameterTypeRequiredDescription
guildIdstringThe guild ID of the role setup.
levelnumberThe 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

ParameterTypeRequiredDescription
clientClientThe Discord client.
guildIdstringThe 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

ParameterTypeRequiredDescription
clientClientThe Discord client.
guildIdstringThe guild ID of the role setup.
optionsLevelRemoveOptionsThe 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

OptionsTypeRequiredDescription
levelnumberLevel to add the role to.
roleRole IDID of the role to add.

LevelRemoveOptions

OptionsTypeRequiredDescription
levelnumberLevel to remove the roles from.