EmojiManager
EmojiManager ⇐ Base
Section titled “EmojiManager ⇐ Base”Represents a manager for handling emojis in a guild.
Kind: global class
Extends: Base
- EmojiManager ⇐
Base- new EmojiManager(client)
- instance
- .cache ⇒
- ._add(emojis, [guildId], [options]) ⇒
Emoji|null - .create([options]) ⇒
Promise.<Emoji> - .edit(emoji, [options]) ⇒
Promise.<Emoji> - .delete(emoji, reason) ⇒
Promise.<Emoji> - .fetch(emoji, [options]) ⇒
Promise.<EmojiCache> - ._fetchId(emoji, [cache], [force]) ⇒
Promise.<Emoji>
- static
- .transformRoles(roles) ⇒
string|undefined - .transformOptions(o) ⇒
Promise.<Object>
- .transformRoles(roles) ⇒
new EmojiManager(client)
Section titled “new EmojiManager(client)”Constructs a new instance of the class.
| Param | Type | Description |
|---|---|---|
| client | Client | The client object used for communication with the server. |
emojiManager.cache ⇒
Section titled “emojiManager.cache ⇒”Getter method for the cache property.
Kind: instance property of EmojiManager
Returns: The Collection object representing the cache.
emojiManager._add(emojis, [guildId], [options]) ⇒ Emoji | null
Section titled “emojiManager._add(emojis, [guildId], [options]) ⇒ Emoji | null”Adds an emoji to the cache and returns the emoji object.
Kind: instance method of EmojiManager
Returns: Emoji | null - The added emoji object, or null if no emoji is provided.
| Param | Type | Default | Description |
|---|---|---|---|
| emojis | string | EmojiResolvable | The emoji or emoji ID to add to the cache. | |
| [guildId] | string | ”this.guildId” | The ID of the guild where the emoji belongs. |
| [options] | object | {cache: true, force: false} | Additional options for adding the emoji. |
| [options.cache] | boolean | true | Whether to cache the emoji object. |
| [options.force] | boolean | false | Whether to force re-fetching the emoji from the API. |
emojiManager.create([options]) ⇒ Promise.<Emoji>
Section titled “emojiManager.create([options]) ⇒ Promise.<Emoji>”Creates a new emoji in the guild.
Kind: instance method of EmojiManager
Returns: Promise.<Emoji> - A promise that resolves with the created emoji.
| Param | Type | Description |
|---|---|---|
| [options] | Object | The options for creating the emoji. |
| [options.reason] | string | The reason for creating the emoji. |
emojiManager.edit(emoji, [options]) ⇒ Promise.<Emoji>
Section titled “emojiManager.edit(emoji, [options]) ⇒ Promise.<Emoji>”Edits an emoji in the guild.
Kind: instance method of EmojiManager
Returns: Promise.<Emoji> - A promise that resolves with the edited emoji.
| Param | Type | Description |
|---|---|---|
| emoji | string | Emoji | The emoji to edit. Can be either the emoji ID or the Emoji object. |
| [options] | Object | Additional options for editing the emoji. |
| [options.reason] | string | The reason for editing the emoji. |
emojiManager.delete(emoji, reason) ⇒ Promise.<Emoji>
Section titled “emojiManager.delete(emoji, reason) ⇒ Promise.<Emoji>”Deletes an emoji from the guild.
Kind: instance method of EmojiManager
Returns: Promise.<Emoji> - - The deleted emoji.
Throws:
Error- If the deletion fails.
| Param | Type | Description |
|---|---|---|
| emoji | string | Emoji | The emoji to delete. Can be either the emoji ID or the Emoji object. |
| reason | string | The reason for deleting the emoji. |
emojiManager.fetch(emoji, [options]) ⇒ Promise.<EmojiCache>
Section titled “emojiManager.fetch(emoji, [options]) ⇒ Promise.<EmojiCache>”Fetches an emoji from the guild’s emoji list.
Kind: instance method of EmojiManager
Returns: Promise.<EmojiCache> - A promise that resolves to the fetched emoji.
| Param | Type | Default | Description |
|---|---|---|---|
| emoji | string | object | The emoji to fetch. Can be either an emoji ID or a string representation of the emoji. | |
| [options] | object | Additional options for the fetch operation. | |
| [options.cache] | boolean | true | Whether to cache the fetched emoji. |
| [options.force] | boolean | false | Whether to force the fetch operation even if the emoji is already cached. |
emojiManager._fetchId(emoji, [cache], [force]) ⇒ Promise.<Emoji>
Section titled “emojiManager._fetchId(emoji, [cache], [force]) ⇒ Promise.<Emoji>”Fetches the ID of an emoji from the guild.
Kind: instance method of EmojiManager
Returns: Promise.<Emoji> - - A promise that resolves to the fetched emoji.
| Param | Type | Default | Description |
|---|---|---|---|
| emoji | string | Emoji | The emoji or the ID of the emoji to fetch. | |
| [cache] | boolean | true | Whether to cache the fetched emoji. |
| [force] | boolean | false | Whether to force fetch the emoji even if it is already cached. |
EmojiManager.transformRoles(roles) ⇒ string | undefined
Section titled “EmojiManager.transformRoles(roles) ⇒ string | undefined”Transforms the given roles object into a string or returns the id property of the roles object.
Kind: static method of EmojiManager
Returns: string | undefined - - The transformed roles as a string or the id property of the roles object.
| Param | Type | Description |
|---|---|---|
| roles | Object | The roles object to transform. |
EmojiManager.transformOptions(o) ⇒ Promise.<Object>
Section titled “EmojiManager.transformOptions(o) ⇒ Promise.<Object>”Transforms the given options object into a new object with modified properties.
Kind: static method of EmojiManager
Returns: Promise.<Object> - - A promise that resolves to the transformed options object.
| Param | Type | Description |
|---|---|---|
| o | Object | The options object to transform. |