メインコンテンツまでスキップ
バージョン: v1.3

roleSetup

This class provides methods to interact with the database. Used for performing operations like creating, updating, deleting, and querying documents.

備考

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
clientClient✅The Discord client.
guildIdstring✅The guild ID of the role setup.
optionsLevelAddOptions✅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​

ParameterTypeRequiredDescription
guildIdstring✅The guild ID of the role setup.
levelnumber✅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​

ParameterTypeRequiredDescription
clientClient✅The Discord client.
guildIdstring✅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​

ParameterTypeRequiredDescription
clientClient✅The Discord client.
guildIdstring✅The guild ID of the role setup.
optionsLevelRemoveOptions✅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​

OptionsTypeRequiredDescription
levelnumber✅Level to add the role to.
roleRole ID✅ID of the role to add.

LevelRemoveOptions​

OptionsTypeRequiredDescription
levelnumber✅Level to remove the roles from.