Skip to content

GuildEmojiManager

classe · Source

Manages API methods for GuildEmojis and stores their cache.

Extends: BaseGuildEmojiManager

Properties

guild

guild: Guild

The guild this manager belongs to Source

cache

cache: Collection<Snowflake, GuildEmoji>

The cache of GuildEmojis Source

_cache

readonly · private

_cache: Collection

The private cache of items for this manager. Source

holds

readonly · private

holds: function

The data structure belonging to this manager. Source

client

readonly

client: Client

The client that instantiated this Manager Source

Methods

create

async

async create(attachment: BufferResolvable | Base64Resolvable, name: string, options?: GuildEmojiCreateOptions): Promise<Emoji>

Creates a new custom emoji in the guild. Parameters

NameTypeDescription
attachmentBufferResolvable | Base64ResolvableThe image for the emoji
namestringThe name for the emoji
options?GuildEmojiCreateOptionsOptions for creating the emoji

Returns: Promise<Emoji> — The created emoji

js
// Create a new emoji from a URL
guild.emojis.create('https://i.imgur.com/w3duR07.png', 'rip')
  .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
  .catch(console.error);
js
// Create a new emoji from a file on your computer
guild.emojis.create('./memes/banana.png', 'banana')
  .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
  .catch(console.error);

Source

fetch

async

async fetch(id?: Snowflake, options?: BaseFetchOptions): Promise<(GuildEmoji|Collection<Snowflake, GuildEmoji>)>

Obtains one or more emojis from Discord, or the emoji cache if they're already available. Parameters

NameTypeDescription
id?SnowflakeThe emoji's id
options?BaseFetchOptionsAdditional options for this fetch

Returns: Promise<(GuildEmoji\|Collection<Snowflake, GuildEmoji>)>

js
// Fetch all emojis from the guild
message.guild.emojis.fetch()
  .then(emojis => console.log(`There are ${emojis.size} emojis.`))
  .catch(console.error);
js
// Fetch a single emoji
message.guild.emojis.fetch('222078108977594368')
  .then(emoji => console.log(`The emoji name is: ${emoji.name}`))
  .catch(console.error);

Source

delete

async

async delete(emoji: EmojiResolvable, reason?: string): Promise<void>

Deletes an emoji. Parameters

NameTypeDescription
emojiEmojiResolvableThe Emoji resolvable to delete
reason?stringReason for deleting the emoji

Returns: Promise<void>Source

edit

async

async edit(emoji: EmojiResolvable, data: GuildEmojiEditData, reason?: string): Promise<GuildEmoji>

Edits an emoji. Parameters

NameTypeDescription
emojiEmojiResolvableThe Emoji resolvable to edit
dataGuildEmojiEditDataThe new data for the emoji
reason?stringReason for editing this emoji

Returns: Promise<GuildEmoji>Source

fetchAuthor

async

async fetchAuthor(emoji: EmojiResolvable): Promise<User>

Fetches the author for this emoji Parameters

NameTypeDescription
emojiEmojiResolvableThe emoji to fetch the author of

Returns: Promise<User>Source

resolve

resolve(emoji: EmojiResolvable): GuildEmoji

Resolves an EmojiResolvable to an Emoji object. Parameters

NameTypeDescription
emojiEmojiResolvableThe Emoji resolvable to identify

Returns: GuildEmojiSource

resolveId

resolveId(emoji: EmojiResolvable): Snowflake

Resolves an EmojiResolvable to an Emoji id string. Parameters

NameTypeDescription
emojiEmojiResolvableThe Emoji resolvable to identify

Returns: SnowflakeSource

resolveIdentifier

resolveIdentifier(emoji: EmojiIdentifierResolvable): string

Resolves an EmojiResolvable to an emoji identifier. Parameters

NameTypeDescription
emojiEmojiIdentifierResolvableThe emoji resolvable to resolve

Returns: stringSource

Unofficial software. Not affiliated with or supported by Discord.