Class Emote
A custom image-based emote.
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
Properties
| Improve this Doc View SourceAnimated
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. |
CreatedAt
Gets when the snowflake was created.
Declaration
public DateTimeOffset CreatedAt { get; }
Property Value
Type | Description |
---|---|
DateTimeOffset | A |
Id
Gets the unique identifier for this object.
Declaration
public ulong Id { get; }
Property Value
Type | Description |
---|---|
UInt64 |
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. |
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 SourceEquals(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 |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
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. |
Returns
Type | Description |
---|---|
Emote | An emote. |
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. |
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 SourceImplicit(String to Emote)
Declaration
public static implicit operator Emote(string s)
Parameters
Type | Name | Description |
---|---|---|
String | s |
Returns
Type | Description |
---|---|
Emote |