fix: add EmbedTypeConverter with unknown handling

Prevents messages with an unknown EmbedType from failing to unmarshal
This commit is contained in:
Christopher Felegy
2019-06-08 19:38:31 -04:00
parent 1cc5d7321b
commit d287ed1d4c
3 changed files with 78 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Discord.Net.Converters;
namespace Discord.API
{
@@ -15,7 +15,7 @@ namespace Discord.API
public string Url { get; set; }
[JsonProperty("color")]
public uint? Color { get; set; }
[JsonProperty("type"), JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("type"), JsonConverter(typeof(EmbedTypeConverter))]
public EmbedType Type { get; set; }
[JsonProperty("timestamp")]
public DateTimeOffset? Timestamp { get; set; }