Skip to main content
Version: 0.9.0

Class: Emoji

The base class for all structures.

Extends​

Constructors​

Constructor​

new Emoji(client, data): Emoji

Parameters​

ParameterType
clientClient
data{ }

Returns​

Emoji

Overrides​

Base.constructor

Properties​

animated​

animated: boolean = false


cachedAt​

cachedAt: number

Inherited from​

Base.cachedAt


client​

protected readonly client: Client

Inherited from​

Base.client


createdAt​

createdAt: Date


createdTimestamp​

createdTimestamp: number


creatorId​

creatorId: string


id​

readonly id: string

Inherited from​

Base.id


name​

name: string


nsfw​

nsfw: boolean = false


parent​

parent: EmojiParent

Methods​

_clone()​

_clone(): this

Helper to quickly clone a structure

Returns​

this

Inherited from​

Base._clone


_patch()​

_patch(data): void

Parameters​

ParameterType
data{ }

Returns​

void


delete()​

delete(): Promise<void>

Deletes this emoji from the server.

Returns​

Promise<void>

A promise that resolves when the emoji has been deleted.

Throws​

If the API request fails or if the emoji is detached.

Example​

// Delete an emoji from the server
await emoji.delete();

edit()​

edit(options): Promise<Emoji>

Edits this emoji's properties.

Parameters​

ParameterTypeDescription
optionsEmojiEditOptionsThe options to edit the emoji with.

Returns​

Promise<Emoji>

A promise that resolves to the edited Emoji object.

Throws​

If the API request fails or if the emoji is detached.

Example​

// Edit an emoji's name
await emoji.edit({ name: "new_name" });

equals()​

equals(other): boolean

Compares this object with another to see if they represent the same entity.

Parameters​

ParameterType
otherstring | Base

Returns​

boolean

Inherited from​

Base.equals


fetch()​

fetch(force?): Promise<Emoji>

Fetch this emoji from the API or resolves it from the local cache.

Parameters​

ParameterTypeDescription
force?booleanWhether to skip the cache check and force a direct API request. Defaults to false.

Returns​

Promise<Emoji>

A promise that resolves to the fetched Emoji object.

Throws​

If the API request fails or if the emoji is detached.

Example​

// Force fetch emoji to update its data
await emoji.fetch(true);

toString()​

toString(): string

Returns the UUID string when the object is cast to a string.

Returns​

string

Inherited from​

Base.toString