Search Results for

    Show / Hide Table of Contents

    Class Emote

    A custom image-based emote.

    Inheritance
    Object
    Emote
    GuildEmote
    Implements
    IEmote
    ISnowflakeEntity
    IEntity<UInt64>
    Namespace: Discord
    Assembly: Discord.Net.Core.dll
    Syntax
    public class Emote : object, IEmote, ISnowflakeEntity, IEntity<ulong>
    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.

    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

    Properties

    | Improve this Doc View Source

    Animated

    Gets whether this emote is animated.

    Declaration
    public bool Animated { get; }
    Property Value
    Type Description
    Boolean

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

    | Improve this Doc View Source

    CreatedAt

    Gets when the snowflake was created.

    Declaration
    public DateTimeOffset CreatedAt { get; }
    Property Value
    Type Description
    DateTimeOffset

    A representing when the entity was first created.

    | Improve this Doc View Source

    Id

    Gets the unique identifier for this object.

    Declaration
    public ulong Id { get; }
    Property Value
    Type Description
    UInt64
    | Improve this Doc View Source

    Name

    Gets the display name or Unicode representation of this emote.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    String

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

    | Improve this Doc View Source

    Url

    Gets the image URL of this emote.

    Declaration
    public string Url { get; }
    Property Value
    Type Description
    String

    A string that points to the URL of this emote.

    Methods

    | Improve this Doc View Source

    Equals(Object)

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

    Declaration
    public override bool Equals(object other)
    Parameters
    Type Name Description
    Object other

    The object to compare with the current object.

    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32
    | Improve this Doc View Source

    Parse(String)

    Parses an Emote from its raw format.

    Declaration
    public static Emote Parse(string text)
    Parameters
    Type Name Description
    String text

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

    Returns
    Type Description
    Emote

    An emote.

    | Improve this Doc View Source

    ToString()

    Returns the raw representation of the emote.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

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

    | Improve this Doc View Source

    TryParse(String, out Emote)

    Tries to parse an Emote from its raw format.

    Declaration
    public static bool TryParse(string text, out Emote result)
    Parameters
    Type Name Description
    String text

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

    Emote result

    An emote.

    Returns
    Type Description
    Boolean

    Operators

    | Improve this Doc View Source

    Implicit(String to Emote)

    Declaration
    public static implicit operator Emote(string s)
    Parameters
    Type Name Description
    String s
    Returns
    Type Description
    Emote

    Implements

    IEmote
    ISnowflakeEntity
    IEntity<TId>

    See Also

    IEmote

    Theme

    • Improve this Doc
    • View Source
    In This Article
    Back to top Discord.Net (c) 2015-2023 3.12.0