| @@ -70,7 +70,7 @@ as in field values. With that in mind, links can be added with | |||||
| Any entity that implements [IUserMessage] has an [AddReactionAsync] | Any entity that implements [IUserMessage] has an [AddReactionAsync] | ||||
| method. This method expects an [IEmote] as a parameter. | method. This method expects an [IEmote] as a parameter. | ||||
| In Discord.Net, an Emote represents a server custom emote, while an | |||||
| In Discord.Net, an Emote represents a custom-image emote, while an | |||||
| Emoji is a Unicode emoji (standard emoji). Both [Emoji] and [Emote] | Emoji is a Unicode emoji (standard emoji). Both [Emoji] and [Emote] | ||||
| implement [IEmote] and are valid options. | implement [IEmote] and are valid options. | ||||
| @@ -1,22 +1,16 @@ | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| /// <summary> | |||||
| /// A unicode emoji. | |||||
| /// </summary> | |||||
| /// <summary> A Unicode emoji. </summary> | |||||
| public class Emoji : IEmote | public class Emoji : IEmote | ||||
| { | { | ||||
| // TODO: need to constrain this to unicode-only emojis somehow | |||||
| /// <summary> | |||||
| /// The unicode representation of this emote. | |||||
| /// </summary> | |||||
| // TODO: need to constrain this to Unicode-only emojis somehow | |||||
| /// <summary> Gets the Unicode representation of this emote. </summary> | |||||
| public string Name { get; } | public string Name { get; } | ||||
| /// <summary> Gets the Unicode representation of this emote. </summary> | |||||
| public override string ToString() => Name; | public override string ToString() => Name; | ||||
| /// <summary> | |||||
| /// Creates a unicode emoji. | |||||
| /// </summary> | |||||
| /// <summary> Creates a Unicode emoji. </summary> | |||||
| /// <param name="unicode">The pure UTF-8 encoding of an emoji</param> | /// <param name="unicode">The pure UTF-8 encoding of an emoji</param> | ||||
| public Emoji(string unicode) | public Emoji(string unicode) | ||||
| { | { | ||||
| @@ -3,24 +3,18 @@ using System.Globalization; | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| /// <summary> | |||||
| /// A custom image-based emote. | |||||
| /// </summary> | |||||
| /// <summary> A custom image-based emote. </summary> | |||||
| public class Emote : IEmote, ISnowflakeEntity | public class Emote : IEmote, ISnowflakeEntity | ||||
| { | { | ||||
| /// <summary> | |||||
| /// The display name (tooltip) of this emote. | |||||
| /// </summary> | |||||
| /// <summary> Gets the display name (tooltip) of this emote. </summary> | |||||
| public string Name { get; } | public string Name { get; } | ||||
| /// <summary> | |||||
| /// The ID of this emote. | |||||
| /// </summary> | |||||
| /// <summary> Gets the ID of this emote. </summary> | |||||
| public ulong Id { get; } | public ulong Id { get; } | ||||
| /// <summary> | |||||
| /// Is this emote animated? | |||||
| /// </summary> | |||||
| /// <summary> Gets whether this emote animated? </summary> | |||||
| public bool Animated { get; } | public bool Animated { get; } | ||||
| /// <summary> Gets the date when this emote is created. </summary> | |||||
| public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | ||||
| /// <summary> Gets the image URL of this emote. </summary> | |||||
| public string Url => CDN.GetEmojiUrl(Id, Animated); | public string Url => CDN.GetEmojiUrl(Id, Animated); | ||||
| internal Emote(ulong id, string name, bool animated) | internal Emote(ulong id, string name, bool animated) | ||||
| @@ -49,16 +43,14 @@ namespace Discord | |||||
| } | } | ||||
| } | } | ||||
| /// <summary> | |||||
| /// Parses an Emote from its raw format. | |||||
| /// </summary> | |||||
| /// <param name="text">The raw encoding of an emote; for example, <:dab:277855270321782784></param> | |||||
| /// <summary> Parses an <see cref="Emote"/> from its raw format. </summary> | |||||
| /// <param name="text">The raw encoding of an emote; for example, <:dab:277855270321782784>.</param> | |||||
| /// <returns>An emote</returns> | /// <returns>An emote</returns> | ||||
| public static Emote Parse(string text) | public static Emote Parse(string text) | ||||
| { | { | ||||
| if (TryParse(text, out Emote result)) | if (TryParse(text, out Emote result)) | ||||
| return result; | return result; | ||||
| throw new ArgumentException("Invalid emote format", nameof(text)); | |||||
| throw new ArgumentException("Invalid emote format.", nameof(text)); | |||||
| } | } | ||||
| public static bool TryParse(string text, out Emote result) | public static bool TryParse(string text, out Emote result) | ||||
| @@ -3,9 +3,7 @@ using System.Diagnostics; | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| /// <summary> | |||||
| /// An image-based emote that is attached to a guild. | |||||
| /// </summary> | |||||
| /// <summary> An image-based emote that is attached to a guild. </summary> | |||||
| [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
| public class GuildEmote : Emote | public class GuildEmote : Emote | ||||
| { | { | ||||
| @@ -1,13 +1,9 @@ | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| /// <summary> | |||||
| /// A general container for any type of emote in a message. | |||||
| /// </summary> | |||||
| /// <summary> Represents a general container for any type of emote in a message. </summary> | |||||
| public interface IEmote | public interface IEmote | ||||
| { | { | ||||
| /// <summary> | |||||
| /// The display name or unicode representation of this emote | |||||
| /// </summary> | |||||
| /// <summary> Gets the display name or Unicode representation of this emote. </summary> | |||||
| string Name { get; } | string Name { get; } | ||||
| } | } | ||||
| } | } | ||||