mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-03-10 00:43:03 +00:00
Show message edits
This commit is contained in:
@@ -10,16 +10,19 @@ namespace DiscordChatExporter.Models
|
|||||||
|
|
||||||
public DateTime TimeStamp { get; }
|
public DateTime TimeStamp { get; }
|
||||||
|
|
||||||
|
public DateTime? EditedTimeStamp { get; }
|
||||||
|
|
||||||
public User Author { get; }
|
public User Author { get; }
|
||||||
|
|
||||||
public string Content { get; }
|
public string Content { get; }
|
||||||
|
|
||||||
public IReadOnlyList<Attachment> Attachments { get; }
|
public IReadOnlyList<Attachment> Attachments { get; }
|
||||||
|
|
||||||
public Message(string id, DateTime timeStamp, User author, string content, IEnumerable<Attachment> attachments)
|
public Message(string id, DateTime timeStamp, DateTime? editedTimeStamp, User author, string content, IEnumerable<Attachment> attachments)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
TimeStamp = timeStamp;
|
TimeStamp = timeStamp;
|
||||||
|
EditedTimeStamp = editedTimeStamp;
|
||||||
Author = author;
|
Author = author;
|
||||||
Content = content;
|
Content = content;
|
||||||
Attachments = attachments.ToArray();
|
Attachments = attachments.ToArray();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace DiscordChatExporter.Services
|
|||||||
// Get basic data
|
// Get basic data
|
||||||
string id = messageJson.Value<string>("id");
|
string id = messageJson.Value<string>("id");
|
||||||
var timeStamp = messageJson.Value<DateTime>("timestamp");
|
var timeStamp = messageJson.Value<DateTime>("timestamp");
|
||||||
|
var editedTimeStamp = messageJson.Value<DateTime?>("edited_timestamp");
|
||||||
string content = messageJson.Value<string>("content");
|
string content = messageJson.Value<string>("content");
|
||||||
|
|
||||||
// Get author
|
// Get author
|
||||||
@@ -44,7 +45,7 @@ namespace DiscordChatExporter.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
var author = new User(authorId, authorName, authorAvatarHash);
|
var author = new User(authorId, authorName, authorAvatarHash);
|
||||||
var message = new Message(id, timeStamp, author, content, attachments);
|
var message = new Message(id, timeStamp, editedTimeStamp, author, content, attachments);
|
||||||
|
|
||||||
yield return message;
|
yield return message;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,15 @@ namespace DiscordChatExporter.Services
|
|||||||
if (message.Content.IsNotBlank())
|
if (message.Content.IsNotBlank())
|
||||||
{
|
{
|
||||||
string content = FormatMessageContent(message.Content);
|
string content = FormatMessageContent(message.Content);
|
||||||
messageBodyHtml.AppendChild(HtmlNode.CreateNode($"<div class=\"msg-content\">{content}</div>"));
|
var contentHtml = messageBodyHtml.AppendChild(HtmlNode.CreateNode($"<div class=\"msg-content\">{content}</div>"));
|
||||||
|
|
||||||
|
// Is edited
|
||||||
|
if (message.EditedTimeStamp != null)
|
||||||
|
{
|
||||||
|
contentHtml.AppendChild(
|
||||||
|
HtmlNode.CreateNode(
|
||||||
|
$"<span class=\"msg-edited\" title=\"{message.EditedTimeStamp:g}\">(edited)</span>"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attachments
|
// Attachments
|
||||||
|
|||||||
@@ -62,6 +62,12 @@
|
|||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
font-weight: 200;
|
font-weight: 200;
|
||||||
}
|
}
|
||||||
|
span.msg-edited {
|
||||||
|
margin-left: 5px;
|
||||||
|
color: #b7bcbf;
|
||||||
|
font-size: 0.8em;
|
||||||
|
font-weight: 200;
|
||||||
|
}
|
||||||
div.msg-content {
|
div.msg-content {
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
color: #939799;
|
color: #939799;
|
||||||
|
|||||||
Reference in New Issue
Block a user