Skip to content

EmojiManager

EmojiManager ⇐ Base

Represents a manager for handling emojis in a guild.

Kind: global class
Extends: Base

new EmojiManager(client)

Constructs a new instance of the class.

ParamTypeDescription
clientClientThe client object used for communication with the server.

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

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.

ParamTypeDefaultDescription
emojisstring | EmojiResolvableThe 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]booleantrueWhether to cache the emoji object.
[options.force]booleanfalseWhether to force re-fetching the emoji from the API.

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.

ParamTypeDescription
[options]ObjectThe options for creating the emoji.
[options.reason]stringThe reason for creating the emoji.

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.

ParamTypeDescription
emojistring | EmojiThe emoji to edit. Can be either the emoji ID or the Emoji object.
[options]ObjectAdditional options for editing the emoji.
[options.reason]stringThe reason for editing the emoji.

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.
ParamTypeDescription
emojistring | EmojiThe emoji to delete. Can be either the emoji ID or the Emoji object.
reasonstringThe reason for deleting the emoji.

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.

ParamTypeDefaultDescription
emojistring | objectThe emoji to fetch. Can be either an emoji ID or a string representation of the emoji.
[options]objectAdditional options for the fetch operation.
[options.cache]booleantrueWhether to cache the fetched emoji.
[options.force]booleanfalseWhether to force the fetch operation even if the emoji is already cached.

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.

ParamTypeDefaultDescription
emojistring | EmojiThe emoji or the ID of the emoji to fetch.
[cache]booleantrueWhether to cache the fetched emoji.
[force]booleanfalseWhether to force fetch the emoji even if it is already cached.

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.

ParamTypeDescription
rolesObjectThe roles object to transform.

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.

ParamTypeDescription
oObjectThe options object to transform.