Skip to content

GuildEmoji

classe · Source

Represents a custom emoji.

Extends: BaseGuildEmoji

Properties

author

nullable

author: User

The user who created this emoji Source

_roles

private

_roles: Array<Snowflake>

Array of role ids this emoji is active for Source

guild

guild: Guild

The guild this emoji is part of Source

deletable

readonly

deletable: boolean

Whether the emoji is deletable by the client user Source

roles

readonly

roles: GuildEmojiRoleManager

A manager for roles this emoji is active for. Source

requiresColons

nullable

requiresColons: boolean

Whether or not this emoji requires colons surrounding it Source

managed

nullable

managed: boolean

Whether this emoji is managed by an external service Source

available

nullable

available: boolean

Whether this emoji is available Source

animated

nullable

animated: boolean

Whether or not the emoji is animated Source

name

nullable

name: string

The emoji's name Source

id

nullable

id: Snowflake

The emoji's id Source

deleted

deprecated

deleted: boolean

Whether or not the structure has been deleted Source

identifier

readonly

identifier: string

The identifier of this emoji, used for message reactions Source

url

readonly · nullable

url: string

The URL to the emoji file if it's a custom emoji Source

createdTimestamp

readonly · nullable

createdTimestamp: number

The timestamp the emoji was created at, or null if unicode Source

createdAt

readonly · nullable

createdAt: Date

The time the emoji was created at, or null if unicode Source

client

readonly

client: Client

The client that instantiated this Source

Methods

fetchAuthor

fetchAuthor(): Promise<User>

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

edit

async

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

Edits the emoji. Parameters

NameTypeDescription
dataGuildEmojiEditDataThe new data for the emoji
reason?stringReason for editing this emoji

Returns: Promise<GuildEmoji>

js
// Edit an emoji
emoji.edit({ name: 'newemoji' })
  .then(e => console.log(`Edited emoji ${e}`))
  .catch(console.error);

Source

setName

setName(name: string, reason?: string): Promise<GuildEmoji>

Sets the name of the emoji. Parameters

NameTypeDescription
namestringThe new name for the emoji
reason?stringReason for changing the emoji's name

Returns: Promise<GuildEmoji>Source

delete

async

async delete(reason?: string): Promise<GuildEmoji>

Deletes the emoji. Parameters

NameTypeDescription
reason?stringReason for deleting the emoji

Returns: Promise<GuildEmoji>Source

equals

equals(other: GuildEmoji | APIEmoji): boolean

Whether this emoji is the same as another one. Parameters

NameTypeDescription
otherGuildEmoji | APIEmojiThe emoji to compare it to

Returns: booleanSource

toString

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. Returns: string

js
// Send a custom emoji from a guild:
const emoji = guild.emojis.cache.first();
msg.channel.send(`Hello! ${emoji}`);
js
// 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}`);

Source

Unofficial software. Not affiliated with or supported by Discord.