Skip to content
SinisterRectus edited this page Nov 16, 2019 · 8 revisions

extends Snowflake

Represents a custom emoji object usable in message content and reactions. Standard unicode emojis do not have a class; they are just strings.

Instances of this class should not be constructed by users.

Properties Inherited From Snowflake

Name Type Description
client Client A shortcut to the client object to which this container is visible.
createdAt number The Unix time in seconds at which this object was created by Discord. Additional decimal points may be present, though only the first 3 (milliseconds) should be considered accurate. Equivalent to Date.parseSnowflake(Snowflake.id).
id string The Snowflake ID that can be used to identify the object. This is guaranteed to be unique except in cases where an object shares the ID of its parent.
parent Container/Client The parent object of to which this container is a child. For example, the parent of a role is the guild in which the role exists.
timestamp string The date and time at which this object was created by Discord, represented as an ISO 8601 string plus microseconds when available. Equivalent to Date.fromSnowflake(Snowflake.id):toISO().

Properties

Name Type Description
animated boolean Whether this emoji is animated.
guild Guild The guild in which the emoji exists.
hash string String with the format name:id, used in HTTP requests. This is different from Emoji:__hash, which returns only the Snowflake ID.
managed boolean Whether this emoji is managed by an integration such as Twitch or YouTube.
mentionString string A string that, when included in a message content, may resolve as an emoji image in the official Discord client.
name string The name of the emoji.
requireColons boolean Whether this emoji requires colons to be used in the official Discord client.
roles ArrayIterable An iterable array of roles that may be required to use this emoji, generally related to integration-managed emojis. Object order is not guaranteed.
url string The URL that can be used to view a full version of the emoji.

Methods Inherited From Snowflake

__eq()

Defines the behavior of the == operator. Allows containers to be directly compared according to their type and __hash return values.

Returns: boolean


__hash()

Returns Snowflake.id

Returns: string


__tostring()

Defines the behavior of the tostring function. All containers follow the format ClassName: hash.

Returns: string


getDate()

Returns a unique Date object that represents when the object was created by Discord. Equivalent to Date.fromSnowflake(Snowflake.id)

This method only operates on data in memory.

Returns: Date


Methods

delete()

Permanently deletes the emoji. This cannot be undone!

This method always makes an HTTP request.

Returns: boolean


hasRole(id)

Parameter Type
id Role-ID-Resolvable

Returns whether or not the provided role is allowed to use the emoji.

This method only operates on data in memory.

Returns: boolean


setName(name)

Parameter Type
name string

Sets the emoji's name. The name must be between 2 and 32 characters in length.

This method always makes an HTTP request.

Returns: boolean


setRoles(roles)

Parameter Type
roles Role-ID-Resolvables

Sets the roles that can use the emoji.

This method always makes an HTTP request.

Returns: boolean


Clone this wiki locally