RolePromptManager
RolePromptManager ⇐ Base
Represents a manager for role prompts in a guild.
Kind: global class
Extends: Base
- RolePromptManager ⇐
Base
- new RolePromptManager(guildId, client)
- instance
- .cache ⇒
- ._add(prompts, [guildId], [options]) ⇒
RolePrompt
|null
- .fetch([options]) ⇒
Promise.<Object>
- .set([options]) ⇒
Promise.<Cache>
- static
- .transformPayload(payload) ⇒
object
- .transformRoles(roles) ⇒
Object
- .transformPayload(payload) ⇒
new RolePromptManager(guildId, client)
Constructs a new instance of the class.
Param | Type | Description |
---|---|---|
guildId | string | The ID of the guild. |
client | Client | The 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.
Param | Type | Default | Description |
---|---|---|---|
prompts | string | RolePrompt | The 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] | boolean | true | Whether to cache the prompt. |
[options.force] | boolean | false | Whether 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.
Param | Type | Description |
---|---|---|
[options] | Object | Optional parameters for the fetch request. |
[options.cache] | boolean | Whether to use cached data or not. |
[options.force] | boolean | Whether 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.
Param | Type | Description |
---|---|---|
[options] | Object | The options for setting the role prompts. |
[options.reason] | string | The 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.
Param | Type | Description |
---|---|---|
payload | object | The 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.
Param | Type | Description |
---|---|---|
roles | Object | The roles object to transform. |