This commit is contained in:
Alexey Golub
2018-06-27 00:30:02 +03:00
parent 69088b83eb
commit 23f9331e4e
4 changed files with 32 additions and 36 deletions

View File

@@ -61,6 +61,18 @@ namespace DiscordChatExporter.Core.Services
return new Role(id, name);
}
private Attachment ParseAttachment(JToken json)
{
var id = json["id"].Value<string>();
var url = json["url"].Value<string>();
var width = json["width"]?.Value<int>();
var height = json["height"]?.Value<int>();
var fileName = json["filename"].Value<string>();
var fileSize = json["size"].Value<long>();
return new Attachment(id, width, height, url, fileName, fileSize);
}
private EmbedAuthor ParseEmbedAuthor(JToken json)
{
var name = json["name"]?.Value<string>();
@@ -79,24 +91,13 @@ namespace DiscordChatExporter.Core.Services
return new EmbedField(name, value, isInline);
}
private Attachment ParseAttachment(JToken json)
{
var id = json["id"].Value<string>();
var url = json["url"].Value<string>();
var isImage = json["width"] != null;
var fileName = json["filename"].Value<string>();
var fileSize = json["size"].Value<long>();
return new Attachment(id, isImage, url, fileName, fileSize);
}
private EmbedImage ParseEmbedImage(JToken json)
{
var url = json["url"]?.Value<string>();
var height = json["height"]?.Value<int>();
var width = json["width"]?.Value<int>();
var height = json["height"]?.Value<int>();
return new EmbedImage(url, height, width);
return new EmbedImage(url, width, height);
}
private EmbedFooter ParseEmbedFooter(JToken json)
@@ -188,7 +189,6 @@ namespace DiscordChatExporter.Core.Services
// Get mentioned users
var mentionedUsers = json["mentions"].EmptyIfNull().Select(ParseUser).ToArray();
return new Message(id, channelId, type, author, timestamp, editedTimestamp, content, attachments, embeds,
reactions, mentionedUsers);
}