Class: GuildEmoji

GuildEmoji

Represents a custom emoji.

Constructor

new GuildEmoji(client, data, guild)

Parameters:
Name Type Description
client Client The instantiating client
data Object The data for the guild emoji
guild Guild The guild the guild emoji is part of
Source:

Extends

Members

(private) _roles :Array.<Snowflake>

Array of role ids this emoji is active for
Type:
Overrides:
Source:

animated :boolean

Whether this emoji is animated
Type:
  • boolean
Overrides:
Source:

(nullable) author :User

The user who created this emoji
Type:
Source:

(nullable) available :boolean

Whether this emoji is available
Type:
  • boolean
Source:

(readonly) client :Client

The client that instantiated this
Type:
Overrides:
Source:

(readonly, nullable) createdAt :Date

The time the emoji was created at, or null if unicode
Type:
  • Date
Overrides:
Source:

(readonly, nullable) createdTimestamp :number

The timestamp the emoji was created at, or null if unicode
Type:
  • number
Overrides:
Source:

(readonly) deletable :boolean

Whether the emoji is deletable by the client user
Type:
  • boolean
Source:

deleted :boolean

Whether this emoji has been deleted
Type:
  • boolean
Overrides:
Source:

guild :Guild

The guild this emoji is part of
Type:
Overrides:
Source:

(nullable) id :Snowflake

The ID of this emoji
Type:
Overrides:
Source:

(readonly) identifier :string

The identifier of this emoji, used for message reactions
Type:
  • string
Overrides:
Source:

(nullable) managed :boolean

Whether this emoji is managed by an external service
Type:
  • boolean
Source:

name :string

The name of this emoji
Type:
  • string
Overrides:
Source:

(nullable) requiresColons :boolean

Whether or not this emoji requires colons surrounding it
Type:
  • boolean
Source:

(readonly) roles :GuildEmojiRoleManager

A manager for roles this emoji is active for.
Type:
Source:

(readonly, nullable) url :string

The URL to the emoji file if its a custom emoji
Type:
  • string
Overrides:
Source:

Methods

delete(reasonopt) → {Promise.<GuildEmoji>}

Deletes the emoji.
Parameters:
Name Type Attributes Description
reason string <optional>
Reason for deleting the emoji
Source:
Returns:
Type
Promise.<GuildEmoji>

edit(data, reasonopt) → {Promise.<GuildEmoji>}

Edits the emoji.
Parameters:
Name Type Attributes Description
data GuildEmojiEditData The new data for the emoji
reason string <optional>
Reason for editing this emoji
Source:
Returns:
Type
Promise.<GuildEmoji>
Example
// Edit an emoji
emoji.edit({ name: 'newemoji' })
  .then(e => console.log(`Edited emoji ${e}`))
  .catch(console.error);

equals(other) → {boolean}

Whether this emoji is the same as another one.
Parameters:
Name Type Description
other GuildEmoji | Object The emoji to compare it to
Source:
Returns:
Whether the emoji is equal to the given emoji or not
Type
boolean

fetchAuthor() → {Promise.<User>}

Fetches the author for this emoji
Source:
Returns:
Type
Promise.<User>

setName(name, reasonopt) → {Promise.<GuildEmoji>}

Sets the name of the emoji.
Parameters:
Name Type Attributes Description
name string The new name for the emoji
reason string <optional>
Reason for changing the emoji's name
Source:
Returns:
Type
Promise.<GuildEmoji>

toString() → {string}

When concatenated with a string, this automatically returns the text required to form a graphical emoji on Discord instead of the Emoji object.
Overrides:
Source:
Returns:
Type
string
Examples
// Send a custom emoji from a guild:
const emoji = guild.emojis.cache.first();
msg.reply(`Hello! ${emoji}`);
// Send the emoji used in a reaction to the channel the reaction is part of
reaction.message.channel.send(`The emoji used was: ${reaction.emoji}`);