Skip to content

Commit

Permalink
Clean embed serialization up slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
foxbot committed Mar 13, 2018
1 parent e9f9b48 commit f175dde
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Discord.Net.Rest/API/Rest/UploadFileParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ public IReadOnlyDictionary<string, object> ToDictionary()
d["nonce"] = Nonce.Value;
if (Embed.IsSpecified)
{
var sb = new StringBuilder(256);
using (TextWriter text = new StringWriter(sb, CultureInfo.InvariantCulture))
using (JsonWriter writer = new JsonTextWriter(text))
var payload = new StringBuilder();
using (var text = new StringWriter(payload))
using (var writer = new JsonTextWriter(text))
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
dictionary["embed"] = Embed.Value;
var map = new Dictionary<string, object>()
{
["embed"] = Embed.Value,
};

_serializer.Serialize(writer, dictionary);
_serializer.Serialize(writer, map);
}
d["payload_json"] = sb.ToString();
d["payload_json"] = payload.ToString();

}
return d;
}
Expand Down

0 comments on commit f175dde

Please sign in to comment.