|
|
@ -39,15 +39,6 @@ namespace DiscordChatExporter.Core.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
using (var writer = new CsvWriter(output))
|
|
|
|
using (var writer = new CsvWriter(output))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Generation info
|
|
|
|
|
|
|
|
writer.WriteComment("https://github.com/Tyrrrz/DiscordChatExporter");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Guild and channel info
|
|
|
|
|
|
|
|
writer.WriteComment($"Guild: {log.Guild.Name}");
|
|
|
|
|
|
|
|
writer.WriteComment($"Channel: {log.Channel.Name}");
|
|
|
|
|
|
|
|
writer.WriteComment($"Topic: {log.Channel.Topic}");
|
|
|
|
|
|
|
|
writer.WriteComment($"Messages: {log.TotalMessageCount:N0}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Headers
|
|
|
|
// Headers
|
|
|
|
writer.WriteField("Author");
|
|
|
|
writer.WriteField("Author");
|
|
|
|
writer.WriteField("Date");
|
|
|
|
writer.WriteField("Date");
|
|
|
@ -62,7 +53,7 @@ namespace DiscordChatExporter.Core.Services
|
|
|
|
foreach (var msg in group.Messages)
|
|
|
|
foreach (var msg in group.Messages)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Author
|
|
|
|
// Author
|
|
|
|
writer.WriteField(msg.Author.FullName, true);
|
|
|
|
writer.WriteField(msg.Author.FullName);
|
|
|
|
|
|
|
|
|
|
|
|
// Date
|
|
|
|
// Date
|
|
|
|
var timeStampFormatted = msg.TimeStamp.ToString(_settingsService.DateFormat);
|
|
|
|
var timeStampFormatted = msg.TimeStamp.ToString(_settingsService.DateFormat);
|
|
|
@ -70,11 +61,11 @@ namespace DiscordChatExporter.Core.Services
|
|
|
|
|
|
|
|
|
|
|
|
// Content
|
|
|
|
// Content
|
|
|
|
var contentFormatted = msg.Content.IsNotBlank() ? FormatMessageContentCsv(msg) : null;
|
|
|
|
var contentFormatted = msg.Content.IsNotBlank() ? FormatMessageContentCsv(msg) : null;
|
|
|
|
writer.WriteField(contentFormatted, true);
|
|
|
|
writer.WriteField(contentFormatted);
|
|
|
|
|
|
|
|
|
|
|
|
// Attachments
|
|
|
|
// Attachments
|
|
|
|
var attachmentsFormatted = msg.Attachments.Select(a => a.Url).JoinToString(",");
|
|
|
|
var attachmentsFormatted = msg.Attachments.Select(a => a.Url).JoinToString(",");
|
|
|
|
writer.WriteField(attachmentsFormatted, true);
|
|
|
|
writer.WriteField(attachmentsFormatted);
|
|
|
|
|
|
|
|
|
|
|
|
await writer.NextRecordAsync();
|
|
|
|
await writer.NextRecordAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|