@@ -8,7 +8,7 @@ namespace Discord | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class Embed : IEmbed | public class Embed : IEmbed | ||||
{ | { | ||||
public string Type { get; } | |||||
public EmbedType Type { get; } | |||||
public string Description { get; internal set; } | public string Description { get; internal set; } | ||||
public Uri Url { get; internal set; } | public Uri Url { get; internal set; } | ||||
@@ -23,12 +23,12 @@ namespace Discord | |||||
public EmbedThumbnail? Thumbnail { get; internal set; } | public EmbedThumbnail? Thumbnail { get; internal set; } | ||||
public ImmutableArray<EmbedField> Fields { get; internal set; } | public ImmutableArray<EmbedField> Fields { get; internal set; } | ||||
internal Embed(string type) | |||||
internal Embed(EmbedType type) | |||||
{ | { | ||||
Type = type; | Type = type; | ||||
Fields = ImmutableArray.Create<EmbedField>(); | Fields = ImmutableArray.Create<EmbedField>(); | ||||
} | } | ||||
internal Embed(string type, | |||||
internal Embed(EmbedType type, | |||||
string title, | string title, | ||||
string description, | string description, | ||||
Uri url, | Uri url, | ||||
@@ -0,0 +1,11 @@ | |||||
namespace Discord | |||||
{ | |||||
public enum EmbedType | |||||
{ | |||||
Rich, | |||||
Link, | |||||
Video, | |||||
Image, | |||||
Gifv | |||||
} | |||||
} |
@@ -6,9 +6,9 @@ namespace Discord | |||||
public interface IEmbed | public interface IEmbed | ||||
{ | { | ||||
Uri Url { get; } | Uri Url { get; } | ||||
string Type { get; } | |||||
string Title { get; } | string Title { get; } | ||||
string Description { get; } | string Description { get; } | ||||
EmbedType Type { get; } | |||||
DateTimeOffset? Timestamp { get; } | DateTimeOffset? Timestamp { get; } | ||||
Color? Color { get; } | Color? Color { get; } | ||||
EmbedImage? Image { get; } | EmbedImage? Image { get; } | ||||
@@ -1,6 +1,7 @@ | |||||
#pragma warning disable CS1591 | #pragma warning disable CS1591 | ||||
using System; | using System; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using Newtonsoft.Json.Converters; | |||||
namespace Discord.API | namespace Discord.API | ||||
{ | { | ||||
@@ -8,14 +9,14 @@ namespace Discord.API | |||||
{ | { | ||||
[JsonProperty("title")] | [JsonProperty("title")] | ||||
public string Title { get; set; } | public string Title { get; set; } | ||||
[JsonProperty("type")] | |||||
public string Type { get; set; } | |||||
[JsonProperty("description")] | [JsonProperty("description")] | ||||
public string Description { get; set; } | public string Description { get; set; } | ||||
[JsonProperty("url")] | [JsonProperty("url")] | ||||
public Uri Url { get; set; } | public Uri Url { get; set; } | ||||
[JsonProperty("color")] | [JsonProperty("color")] | ||||
public uint? Color { get; set; } | public uint? Color { get; set; } | ||||
[JsonProperty("type"), JsonConverter(typeof(StringEnumConverter))] | |||||
public EmbedType Type { get; set; } | |||||
[JsonProperty("timestamp")] | [JsonProperty("timestamp")] | ||||
public DateTimeOffset? Timestamp { get; set; } | public DateTimeOffset? Timestamp { get; set; } | ||||
[JsonProperty("author")] | [JsonProperty("author")] | ||||
@@ -15,7 +15,7 @@ namespace Discord | |||||
public EmbedBuilder() | public EmbedBuilder() | ||||
{ | { | ||||
_embed = new Embed("rich"); | |||||
_embed = new Embed(EmbedType.Rich); | |||||
Fields = new List<EmbedFieldBuilder>(); | Fields = new List<EmbedFieldBuilder>(); | ||||
} | } | ||||