Clean embed serialization up slightly

This commit is contained in:
Christopher F
2018-03-13 19:16:12 -04:00
parent e9f9b484b6
commit f175dde2b3

View File

@@ -38,16 +38,19 @@ namespace Discord.API.Rest
d["nonce"] = Nonce.Value; d["nonce"] = Nonce.Value;
if (Embed.IsSpecified) if (Embed.IsSpecified)
{ {
var sb = new StringBuilder(256); var payload = new StringBuilder();
using (TextWriter text = new StringWriter(sb, CultureInfo.InvariantCulture)) using (var text = new StringWriter(payload))
using (JsonWriter writer = new JsonTextWriter(text)) using (var writer = new JsonTextWriter(text))
{ {
Dictionary<string, object> dictionary = new Dictionary<string, object>(); var map = new Dictionary<string, object>()
dictionary["embed"] = Embed.Value; {
["embed"] = Embed.Value,
};
_serializer.Serialize(writer, dictionary); _serializer.Serialize(writer, map);
} }
d["payload_json"] = sb.ToString(); d["payload_json"] = payload.ToString();
} }
return d; return d;
} }