StickerManager
StickerManager ⇐ Base
Represents a Sticker Manager that handles operations related to stickers in a guild.
Kind: global class
Extends: Base
- StickerManager ⇐
Base
- new StickerManager(client)
- .cache ⇒
- ._add(stickers, [guildId], [options]) ⇒
Sticker
|null
- .fetch(sticker, [options]) ⇒
Promise.<Sticker>
- ._fetchId(sticker, [cache], [force]) ⇒
Promise.<Sticker>
- .create([options]) ⇒
Promise.<Sticker>
- .edit(sticker, [options]) ⇒
Promise.<Sticker>
- .delete(sticker, reason) ⇒
Promise.<Sticker>
new StickerManager(client)
Constructs a new instance of the class.
Param | Type | Description |
---|---|---|
client | Client | The client object used for communication with the server. |
stickerManager.cache ⇒
Getter method for the cache property.
Kind: instance property of StickerManager
Returns: The Collection object representing the cache.
stickerManager._add(stickers, [guildId], [options]) ⇒ Sticker
| null
Adds a sticker to the cache and returns the sticker object.
Kind: instance method of StickerManager
Returns: Sticker
| null
- The sticker object that was added to the cache
Param | Type | Default | Description |
---|---|---|---|
stickers | string | Sticker | The sticker object or sticker ID to add to the cache. | |
[guildId] | string | ”this.guildId” | The ID of the guild where the sticker belongs. |
[options] | object | {cache: true, force: false} | Additional options for adding the sticker. |
[options.cache] | boolean | true | Whether to cache the sticker object. |
[options.force] | boolean | false | Whether to force fetching the sticker even if it is already in the cache. |
stickerManager.fetch(sticker, [options]) ⇒ Promise.<Sticker>
Fetches a sticker from the server based on the provided sticker ID or options.
Kind: instance method of StickerManager
Returns: Promise.<Sticker>
- - A promise that resolves to the fetched sticker.
Param | Type | Default | Description |
---|---|---|---|
sticker | string | object | The sticker ID or options object. | |
[options] | object | The options for fetching the sticker. | |
[options.cache] | boolean | true | Whether to cache the fetched sticker. |
[options.force] | boolean | false | Whether to force fetch the sticker even if it is already cached. |
stickerManager._fetchId(sticker, [cache], [force]) ⇒ Promise.<Sticker>
Fetches the ID of a sticker from the server.
Kind: instance method of StickerManager
Returns: Promise.<Sticker>
- - A promise that resolves with the fetched sticker.
Param | Type | Default | Description |
---|---|---|---|
sticker | string | Sticker | The sticker or sticker ID to fetch. | |
[cache] | boolean | true | Whether to cache the fetched sticker. |
[force] | boolean | false | Whether to force fetching the sticker even if it is already cached. |
stickerManager.create([options]) ⇒ Promise.<Sticker>
Creates a sticker in the guild.
Kind: instance method of StickerManager
Returns: Promise.<Sticker>
- A promise that resolves with the created sticker.
Param | Type | Description |
---|---|---|
[options] | Object | The options for creating the sticker. |
[options.reason] | string | The reason for creating the sticker. |
stickerManager.edit(sticker, [options]) ⇒ Promise.<Sticker>
Edits a sticker with the given options.
Kind: instance method of StickerManager
Returns: Promise.<Sticker>
- A promise that resolves with the edited sticker.
Param | Type | Description |
---|---|---|
sticker | string | Sticker | The sticker to edit. Can be either a sticker ID or a sticker object. |
[options] | Object | The options for editing the sticker. |
[options.reason] | string | The reason for editing the sticker. |
stickerManager.delete(sticker, reason) ⇒ Promise.<Sticker>
Deletes a sticker from the guild.
Kind: instance method of StickerManager
Returns: Promise.<Sticker>
- - The deleted sticker object.
Throws:
Error
- If the sticker deletion fails.
Param | Type | Description |
---|---|---|
sticker | string | Sticker | The sticker to delete. Can be either a sticker ID or a sticker object. |
reason | string | The reason for deleting the sticker. |