Skip to content

RolePromptManager

RolePromptManager ⇐ Base

Represents a manager for role prompts in a guild.

Kind: global class
Extends: Base

new RolePromptManager(guildId, client)

Constructs a new instance of the class.

ParamTypeDescription
guildIdstringThe ID of the guild.
clientClientThe client instance.

rolePromptManager.cache ⇒

Getter method for the cache property.

Kind: instance property of RolePromptManager
Returns: The Collection object representing the cache.

rolePromptManager._add(prompts, [guildId], [options]) ⇒ RolePrompt | null

Adds a role prompt to the collection.

Kind: instance method of RolePromptManager
Returns: RolePrompt | null - The added role prompt or null if prompts is falsy.

ParamTypeDefaultDescription
promptsstring | RolePromptThe ID of the prompt or the prompt object itself.
[guildId]string”this.guildId”The ID of the guild where the prompt is added.
[options]object{cache: true, force: false}Additional options for adding the prompt.
[options.cache]booleantrueWhether to cache the prompt.
[options.force]booleanfalseWhether to force adding the prompt even if it already exists in the cache.

rolePromptManager.fetch([options]) ⇒ Promise.<Object>

Fetches role prompts from the server.

Kind: instance method of RolePromptManager
Returns: Promise.<Object> - - A promise that resolves to the fetched role prompts.

ParamTypeDescription
[options]ObjectOptional parameters for the fetch request.
[options.cache]booleanWhether to use cached data or not.
[options.force]booleanWhether to force a fresh fetch or not.

rolePromptManager.set([options]) ⇒ Promise.<Cache>

Sets the role prompts for the guild.

Kind: instance method of RolePromptManager
Returns: Promise.<Cache> - A promise that resolves with a new instance of the cache containing the updated role prompts.

ParamTypeDescription
[options]ObjectThe options for setting the role prompts.
[options.reason]stringThe reason for setting the role prompts.

RolePromptManager.transformPayload(payload) ⇒ object

Transforms the given payload object into a new object with specific properties.

Kind: static method of RolePromptManager
Returns: object - - The transformed object with properties: title, description, required, and roles.

ParamTypeDescription
payloadobjectThe payload object to transform.

RolePromptManager.transformRoles(roles) ⇒ Object

Transforms a roles object into a new format.

Kind: static method of RolePromptManager
Returns: Object - - The transformed roles object.

ParamTypeDescription
rolesObjectThe roles object to transform.