Table of Contents

Class Emote

Namespace
Discord
Assembly
Discord.Net.Core.dll

A custom image-based emote.

public class Emote : IEmote, ISnowflakeEntity, IEntity<ulong>
Inheritance
Emote
Implements
Derived
Inherited Members

Examples

The sample below sends a message and adds an Emoji and a custom Emote to the message.

public async Task SendAndReactAsync(ISocketMessageChannel channel)
{
    var message = await channel.SendMessageAsync("I am a message.");

    // Creates a Unicode-based emoji based on the Unicode string.
    // This is effectively the same as new Emoji("💕").
    var heartEmoji = new Emoji("\U0001f495");
    // Reacts to the message with the Emoji.
    await message.AddReactionAsync(heartEmoji);

    // Parses a custom emote based on the provided Discord emote format.
    // Please note that this does not guarantee the existence of
    // the emote.
    var emote = Emote.Parse("<:thonkang:282745590985523200>");
    // Reacts to the message with the Emote.
    await message.AddReactionAsync(emote);
}

Result

React Example

Remarks

Note

A valid Emote format is <:emoteName:emoteId>. This can be obtained by escaping with a \ in front of the emote using the Discord chat client.

This class represents a custom emoji. This type of emoji can be created via the Parse or TryParse method.

Properties

Animated

Gets whether this emote is animated.

public bool Animated { get; }

Property Value

bool

A boolean that determines whether or not this emote is an animated one.

CreatedAt

Gets when the snowflake was created.

public DateTimeOffset CreatedAt { get; }

Property Value

DateTimeOffset

A DateTimeOffset representing when the entity was first created.

Id

Gets the unique identifier for this object.

public ulong Id { get; }

Property Value

ulong

Name

Gets the display name or Unicode representation of this emote.

public string Name { get; }

Property Value

string

A string representing the display name or the Unicode representation (e.g. 🤔) of this emote.

Url

Gets the image URL of this emote.

public string Url { get; }

Property Value

string

A string that points to the URL of this emote.

Methods

Equals(object)

Determines whether the specified emote is equal to the current emote.

public override bool Equals(object other)

Parameters

other object

The object to compare with the current object.

Returns

bool

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Parse(string)

Parses an Emote from its raw format.

public static Emote Parse(string text)

Parameters

text string

The raw encoding of an emote (e.g. <:dab:277855270321782784>).

Returns

Emote

An emote.

Exceptions

ArgumentException

Invalid emote format.

ToString()

Returns the raw representation of the emote.

public override string ToString()

Returns

string

A string representing the raw presentation of the emote (e.g. <:thonkang:282745590985523200>).

TryParse(string, out Emote)

Tries to parse an Emote from its raw format.

public static bool TryParse(string text, out Emote result)

Parameters

text string

The raw encoding of an emote; for example, <:dab:277855270321782784>.

result Emote

An emote.

Returns

bool

Operators

implicit operator Emote(string)

public static implicit operator Emote(string s)

Parameters

s string

Returns

Emote

See Also