diff --git a/DiscordChatExporter/Models/Channel.cs b/DiscordChatExporter/Models/Channel.cs index 5071cca..ff1b190 100644 --- a/DiscordChatExporter/Models/Channel.cs +++ b/DiscordChatExporter/Models/Channel.cs @@ -6,12 +6,15 @@ public string Name { get; } + public string Topic { get; } + public ChannelType Type { get; } - public Channel(string id, string name, ChannelType type) + public Channel(string id, string name, string topic, ChannelType type) { Id = id; Name = name; + Topic = topic; Type = type; } diff --git a/DiscordChatExporter/Models/User.cs b/DiscordChatExporter/Models/User.cs index beec8d5..44812fa 100644 --- a/DiscordChatExporter/Models/User.cs +++ b/DiscordChatExporter/Models/User.cs @@ -10,6 +10,8 @@ namespace DiscordChatExporter.Models public string Name { get; } + public string FullyQualifiedName => $"{Name}#{Discriminator:0000}"; + public string AvatarHash { get; } public string AvatarUrl => AvatarHash.IsNotBlank() @@ -26,7 +28,7 @@ namespace DiscordChatExporter.Models public override string ToString() { - return $"{Name}#{Discriminator}"; + return FullyQualifiedName; } } } \ No newline at end of file diff --git a/DiscordChatExporter/Resources/ExportService/DarkTheme.css b/DiscordChatExporter/Resources/ExportService/DarkTheme.css index 45fad54..74c3ace 100644 --- a/DiscordChatExporter/Resources/ExportService/DarkTheme.css +++ b/DiscordChatExporter/Resources/ExportService/DarkTheme.css @@ -10,7 +10,9 @@ a { text-decoration: none; } -a:hover { text-decoration: underline; } +a:hover { + text-decoration: underline; +} div.pre { background-color: #2F3136; @@ -37,7 +39,9 @@ div#info { max-width: 100%; } -div#log { max-width: 100%; } +div#log { + max-width: 100%; +} img.guild-icon { max-height: 64px; @@ -51,15 +55,22 @@ div.info-right { div.guild-name { color: #FFFFFF; - font-size: 1.4rem; + font-size: 1.4em; } div.channel-name { color: #FFFFFF; - font-size: 1.2rem; + font-size: 1.2em; +} + +div.channel-topic { + margin-top: 2px; + color: #FFFFFF; } -div.misc { margin-top: 2px; } +div.channel-messagecount { + margin-top: 2px; +} div.msg { border-top: 1px solid rgba(255, 255, 255, 0.04); @@ -88,23 +99,23 @@ div.msg-right { span.msg-user { color: #FFFFFF; - font-size: 1rem; + font-size: 1em; } span.msg-date { color: rgba(255, 255, 255, 0.2); - font-size: .75rem; + font-size: .75em; margin-left: 5px; } span.msg-edited { color: rgba(255, 255, 255, 0.2); - font-size: .8rem; + font-size: .8em; margin-left: 5px; } div.msg-content { - font-size: .9375rem; + font-size: .9375em; padding-top: 5px; word-break: break-all; } diff --git a/DiscordChatExporter/Resources/ExportService/LightTheme.css b/DiscordChatExporter/Resources/ExportService/LightTheme.css index 41bfe1b..89876bb 100644 --- a/DiscordChatExporter/Resources/ExportService/LightTheme.css +++ b/DiscordChatExporter/Resources/ExportService/LightTheme.css @@ -10,7 +10,9 @@ a { text-decoration: none; } -a:hover { text-decoration: underline; } +a:hover { + text-decoration: underline; +} div.pre { background-color: #F9F9F9; @@ -37,7 +39,9 @@ div#info { max-width: 100%; } -div#log { max-width: 100%; } +div#log { + max-width: 100%; +} img.guild-icon { max-height: 64px; @@ -51,15 +55,22 @@ div.info-right { div.guild-name { color: #2F3136; - font-size: 1.4rem; + font-size: 1.4em; } div.channel-name { color: #2F3136; - font-size: 1.2rem; + font-size: 1.2em; +} + +div.channel-topic { + margin-top: 2px; + color: #2F3136; } -div.misc { margin-top: 2px; } +div.channel-messagecount { + margin-top: 2px; +} div.msg { border-top: 1px solid #ECEEEF; @@ -88,23 +99,23 @@ div.msg-right { span.msg-user { color: #2F3136; - font-size: 1rem; + font-size: 1em; } span.msg-date { color: #99AAB5; - font-size: .75rem; + font-size: .75em; margin-left: 5px; } span.msg-edited { color: #99AAB5; - font-size: .8rem; + font-size: .8em; margin-left: 5px; } div.msg-content { - font-size: .9375rem; + font-size: .9375em; padding-top: 5px; word-break: break-all; } diff --git a/DiscordChatExporter/Services/DataService.cs b/DiscordChatExporter/Services/DataService.cs index a118040..578544e 100644 --- a/DiscordChatExporter/Services/DataService.cs +++ b/DiscordChatExporter/Services/DataService.cs @@ -52,6 +52,7 @@ namespace DiscordChatExporter.Services // Get basic data var id = token.Value("id"); var type = (ChannelType) token.Value("type"); + var topic = token.Value("topic"); // Extract name based on type string name; @@ -65,7 +66,7 @@ namespace DiscordChatExporter.Services name = token.Value("name"); } - return new Channel(id, name, type); + return new Channel(id, name, topic, type); } private Message ParseMessage(JToken token) @@ -129,7 +130,7 @@ namespace DiscordChatExporter.Services .Select(m => m.Groups[1].Value) .ExceptBlank() .Select(i => _channelCache.GetOrDefault(i) ?? - new Channel(i, "deleted-channel", ChannelType.GuildTextChat)) + new Channel(i, "deleted-channel", null, ChannelType.GuildTextChat)) .ToArray(); return new Message(id, type, author, timeStamp, editedTimeStamp, content, attachments, diff --git a/DiscordChatExporter/Services/ExportService.cs b/DiscordChatExporter/Services/ExportService.cs index 31492aa..43200ad 100644 --- a/DiscordChatExporter/Services/ExportService.cs +++ b/DiscordChatExporter/Services/ExportService.cs @@ -28,8 +28,9 @@ namespace DiscordChatExporter.Services // Guild and channel info await writer.WriteLineAsync('='.Repeat(48)); - await writer.WriteLineAsync($"Guild: {log.Guild}"); - await writer.WriteLineAsync($"Channel: {log.Channel}"); + await writer.WriteLineAsync($"Guild: {log.Guild.Name}"); + await writer.WriteLineAsync($"Channel: {log.Channel.Name}"); + await writer.WriteLineAsync($"Topic: {log.Channel.Topic}"); await writer.WriteLineAsync($"Messages: {log.TotalMessageCount:N0}"); await writer.WriteLineAsync('='.Repeat(48)); await writer.WriteLineAsync(); @@ -38,7 +39,7 @@ namespace DiscordChatExporter.Services foreach (var group in log.MessageGroups) { var timeStampFormatted = group.TimeStamp.ToString(_settingsService.DateFormat); - await writer.WriteLineAsync($"{group.Author} [{timeStampFormatted}]"); + await writer.WriteLineAsync($"{group.Author.FullyQualifiedName} [{timeStampFormatted}]"); // Messages foreach (var message in group.Messages) @@ -75,7 +76,7 @@ namespace DiscordChatExporter.Services // HEAD await writer.WriteLineAsync(""); - await writer.WriteLineAsync($"{log.Guild} - {log.Channel}"); + await writer.WriteLineAsync($"{log.Guild.Name} - {log.Channel.Name}"); await writer.WriteLineAsync(""); await writer.WriteLineAsync(""); await writer.WriteLineAsync($""); @@ -90,9 +91,11 @@ namespace DiscordChatExporter.Services await writer.WriteLineAsync($""); await writer.WriteLineAsync(""); // info-left await writer.WriteLineAsync("
"); - await writer.WriteLineAsync($"
{log.Guild}
"); - await writer.WriteLineAsync($"
{log.Channel}
"); - await writer.WriteLineAsync($"
{log.TotalMessageCount:N0} messages
"); + await writer.WriteLineAsync($"
{log.Guild.Name}
"); + await writer.WriteLineAsync($"
{log.Channel.Name}
"); + await writer.WriteLineAsync($"
{log.Channel.Topic}
"); + await writer.WriteLineAsync( + $"
{log.TotalMessageCount:N0} messages
"); await writer.WriteLineAsync("
"); // info-right await writer.WriteLineAsync(""); // info @@ -106,7 +109,8 @@ namespace DiscordChatExporter.Services await writer.WriteLineAsync(""); await writer.WriteLineAsync("
"); - await writer.WriteAsync($""); + await writer.WriteAsync( + $""); await writer.WriteAsync(HtmlEncode(group.Author.Name)); await writer.WriteLineAsync(""); var timeStampFormatted = HtmlEncode(group.TimeStamp.ToString(_settingsService.DateFormat));