This commit is contained in:
Tyrrrz 2021-12-08 23:50:21 +02:00
parent 8e7baee8a5
commit 880f400e2c
148 changed files with 14241 additions and 14396 deletions

View file

@ -14,8 +14,8 @@ using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Exporting;
using JsonExtensions;
namespace DiscordChatExporter.Cli.Tests.Fixtures
{
namespace DiscordChatExporter.Cli.Tests.Fixtures;
public class ExportWrapperFixture : IDisposable
{
private string DirPath { get; } = Path.Combine(
@ -129,4 +129,3 @@ namespace DiscordChatExporter.Cli.Tests.Fixtures
public void Dispose() => DirectoryEx.DeleteIfExists(DirPath);
}
}

View file

@ -2,8 +2,8 @@
using System.IO;
using DiscordChatExporter.Cli.Tests.Utils;
namespace DiscordChatExporter.Cli.Tests.Fixtures
{
namespace DiscordChatExporter.Cli.Tests.Fixtures;
public class TempOutputFixture : IDisposable
{
public string DirPath { get; } = Path.Combine(
@ -20,4 +20,3 @@ namespace DiscordChatExporter.Cli.Tests.Fixtures
public void Dispose() => DirectoryEx.DeleteIfExists(DirPath);
}
}

View file

@ -1,8 +1,8 @@
using System;
using System.IO;
namespace DiscordChatExporter.Cli.Tests.Infra
{
namespace DiscordChatExporter.Cli.Tests.Infra;
internal static class Secrets
{
private static readonly Lazy<string> DiscordTokenLazy = new(() =>
@ -43,4 +43,3 @@ namespace DiscordChatExporter.Cli.Tests.Infra
public static bool IsDiscordTokenBot => IsDiscordTokenBotLazy.Value;
}
}

View file

@ -4,8 +4,8 @@ using DiscordChatExporter.Cli.Tests.TestData;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.CsvWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.CsvWriting;
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -28,4 +28,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.CsvWriting
);
}
}
}

View file

@ -13,8 +13,8 @@ using FluentAssertions;
using JsonExtensions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs
{
namespace DiscordChatExporter.Cli.Tests.Specs;
public record DateRangeSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutputFixture>
{
[Fact]
@ -157,4 +157,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs
});
}
}
}

View file

@ -12,8 +12,8 @@ using FluentAssertions;
using JsonExtensions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs
{
namespace DiscordChatExporter.Cli.Tests.Specs;
public record FilterSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutputFixture>
{
[Fact]
@ -132,4 +132,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs
.ContainSingle("This has mention");
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -90,4 +90,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
);
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Cli.Tests.TestData;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -40,4 +40,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
);
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
public record EmbedSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -61,4 +61,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
iframeSrc.Should().StartWithEquivalentOf("https://www.youtube.com/embed/qOWW4OlgbvE");
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -63,4 +63,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
message.Text().Trim().Should().Be("Role mention: @Role 1");
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting;
public record ReplySpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -54,4 +54,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
.Be("Click to see attachment 🖼️");
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
public record AttachmentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -98,4 +98,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
attachments.Single().GetProperty("fileSizeBytes").GetInt64().Should().Be(1087849);
}
}
}

View file

@ -5,8 +5,8 @@ using DiscordChatExporter.Cli.Tests.TestData;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -39,4 +39,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
);
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
public record EmbedSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -55,4 +55,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
embedFields[2].GetProperty("isInline").GetBoolean().Should().BeTrue();
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting;
public record MentionSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -68,4 +68,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
message.GetProperty("content").GetString().Should().Be("Role mention: @Role 1");
}
}
}

View file

@ -10,8 +10,8 @@ using DiscordChatExporter.Core.Exporting.Partitioning;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs
{
namespace DiscordChatExporter.Cli.Tests.Specs;
public record PartitioningSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutputFixture>
{
[Fact]
@ -64,4 +64,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs
.HaveCount(2);
}
}
}

View file

@ -4,8 +4,8 @@ using DiscordChatExporter.Cli.Tests.TestData;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs.PlainTextWriting
{
namespace DiscordChatExporter.Cli.Tests.Specs.PlainTextWriting;
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
{
[Fact]
@ -28,4 +28,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs.PlainTextWriting
);
}
}
}

View file

@ -11,8 +11,8 @@ using DiscordChatExporter.Core.Exporting;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs
{
namespace DiscordChatExporter.Cli.Tests.Specs;
public record SelfContainedSpecs(TempOutputFixture TempOutput) : IClassFixture<TempOutputFixture>
{
[Fact]
@ -46,4 +46,3 @@ namespace DiscordChatExporter.Cli.Tests.Specs
.BeTrue();
}
}
}

View file

@ -1,7 +1,7 @@
using DiscordChatExporter.Core.Discord;
namespace DiscordChatExporter.Cli.Tests.TestData
{
namespace DiscordChatExporter.Cli.Tests.TestData;
public static class ChannelIds
{
public static Snowflake AttachmentTestCases { get; } = Snowflake.Parse("885587741654536192");
@ -18,4 +18,3 @@ namespace DiscordChatExporter.Cli.Tests.TestData
public static Snowflake SelfContainedTestCases { get; } = Snowflake.Parse("887441432678379560");
}
}

View file

@ -1,7 +1,7 @@
using System.IO;
namespace DiscordChatExporter.Cli.Tests.Utils
{
namespace DiscordChatExporter.Cli.Tests.Utils;
internal static class DirectoryEx
{
public static void DeleteIfExists(string dirPath, bool recursive = true)
@ -21,4 +21,3 @@ namespace DiscordChatExporter.Cli.Tests.Utils
Directory.CreateDirectory(dirPath);
}
}
}

View file

@ -1,12 +1,11 @@
using AngleSharp.Html.Dom;
using AngleSharp.Html.Parser;
namespace DiscordChatExporter.Cli.Tests.Utils
{
namespace DiscordChatExporter.Cli.Tests.Utils;
internal static class Html
{
private static readonly IHtmlParser Parser = new HtmlParser();
public static IHtmlDocument Parse(string source) => Parser.ParseDocument(source);
}
}

View file

@ -16,8 +16,8 @@ using DiscordChatExporter.Core.Exporting.Filtering;
using DiscordChatExporter.Core.Exporting.Partitioning;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands.Base
{
namespace DiscordChatExporter.Cli.Commands.Base;
public abstract class ExportCommandBase : TokenCommandBase
{
[CommandOption("output", 'o', Description = "Output file or directory path.")]
@ -153,4 +153,3 @@ namespace DiscordChatExporter.Cli.Commands.Base
await ExecuteAsync(console, channels);
}
}
}

View file

@ -4,8 +4,8 @@ using CliFx.Attributes;
using CliFx.Infrastructure;
using DiscordChatExporter.Core.Discord;
namespace DiscordChatExporter.Cli.Commands.Base
{
namespace DiscordChatExporter.Cli.Commands.Base;
public abstract class TokenCommandBase : ICommand
{
[CommandOption("token", 't', IsRequired = true, EnvironmentVariable = "DISCORD_TOKEN", Description = "Authentication token.")]
@ -27,4 +27,3 @@ namespace DiscordChatExporter.Cli.Commands.Base
public abstract ValueTask ExecuteAsync(IConsole console);
}
}

View file

@ -5,8 +5,8 @@ using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Cli.Commands
{
namespace DiscordChatExporter.Cli.Commands;
[Command("exportall", Description = "Export all accessible channels.")]
public class ExportAllCommand : ExportCommandBase
{
@ -38,4 +38,3 @@ namespace DiscordChatExporter.Cli.Commands
await base.ExecuteAsync(console, channels);
}
}
}

View file

@ -6,8 +6,8 @@ using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord;
namespace DiscordChatExporter.Cli.Commands
{
namespace DiscordChatExporter.Cli.Commands;
[Command("export", Description = "Export one or multiple channels.")]
public class ExportChannelsCommand : ExportCommandBase
{
@ -18,4 +18,3 @@ namespace DiscordChatExporter.Cli.Commands
public override async ValueTask ExecuteAsync(IConsole console) =>
await base.ExecuteAsync(console, ChannelIds);
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands
{
namespace DiscordChatExporter.Cli.Commands;
[Command("exportdm", Description = "Export all direct message channels.")]
public class ExportDirectMessagesCommand : ExportCommandBase
{
@ -22,4 +22,3 @@ namespace DiscordChatExporter.Cli.Commands
await base.ExecuteAsync(console, textChannels);
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands
{
namespace DiscordChatExporter.Cli.Commands;
[Command("exportguild", Description = "Export all channels within specified guild.")]
public class ExportGuildCommand : ExportCommandBase
{
@ -25,4 +25,3 @@ namespace DiscordChatExporter.Cli.Commands
await base.ExecuteAsync(console, textChannels);
}
}
}

View file

@ -7,8 +7,8 @@ using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands
{
namespace DiscordChatExporter.Cli.Commands;
[Command("channels", Description = "Get the list of channels in a guild.")]
public class GetChannelsCommand : TokenCommandBase
{
@ -42,4 +42,3 @@ namespace DiscordChatExporter.Cli.Commands
}
}
}
}

View file

@ -7,8 +7,8 @@ using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands
{
namespace DiscordChatExporter.Cli.Commands;
[Command("dm", Description = "Get the list of direct message channels.")]
public class GetDirectMessageChannelsCommand : TokenCommandBase
{
@ -39,4 +39,3 @@ namespace DiscordChatExporter.Cli.Commands
}
}
}
}

View file

@ -6,8 +6,8 @@ using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands
{
namespace DiscordChatExporter.Cli.Commands;
[Command("guilds", Description = "Get the list of accessible guilds.")]
public class GetGuildsCommand : TokenCommandBase
{
@ -32,4 +32,3 @@ namespace DiscordChatExporter.Cli.Commands
}
}
}
}

View file

@ -4,8 +4,8 @@ using CliFx;
using CliFx.Attributes;
using CliFx.Infrastructure;
namespace DiscordChatExporter.Cli.Commands
{
namespace DiscordChatExporter.Cli.Commands;
[Command("guide", Description = "Explains how to obtain token, guild or channel ID.")]
public class GuideCommand : ICommand
{
@ -68,4 +68,3 @@ namespace DiscordChatExporter.Cli.Commands
return default;
}
}
}

View file

@ -1,14 +1,6 @@
using System.Threading.Tasks;
using CliFx;
using CliFx;
namespace DiscordChatExporter.Cli
{
public static class Program
{
public static async Task<int> Main(string[] args) =>
await new CliApplicationBuilder()
return await new CliApplicationBuilder()
.AddCommandsFromThisAssembly()
.Build()
.RunAsync(args);
}
}

View file

@ -3,8 +3,8 @@ using System.Threading.Tasks;
using CliFx.Infrastructure;
using Spectre.Console;
namespace DiscordChatExporter.Cli.Utils.Extensions
{
namespace DiscordChatExporter.Cli.Utils.Extensions;
internal static class ConsoleExtensions
{
public static IAnsiConsole CreateAnsiConsole(this IConsole console) =>
@ -48,4 +48,3 @@ namespace DiscordChatExporter.Cli.Utils.Extensions
}
}
}
}

View file

@ -1,7 +1,7 @@
using System.Net.Http.Headers;
namespace DiscordChatExporter.Core.Discord
{
namespace DiscordChatExporter.Core.Discord;
public record AuthToken(AuthTokenKind Kind, string Value)
{
public AuthenticationHeaderValue GetAuthenticationHeader() => Kind switch
@ -10,4 +10,3 @@ namespace DiscordChatExporter.Core.Discord
_ => new AuthenticationHeaderValue(Value)
};
}
}

View file

@ -1,8 +1,7 @@
namespace DiscordChatExporter.Core.Discord
{
namespace DiscordChatExporter.Core.Discord;
public enum AuthTokenKind
{
User,
Bot
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Utils;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/channel#attachment-object
public partial record Attachment(
Snowflake Id,
@ -42,4 +42,3 @@ namespace DiscordChatExporter.Core.Discord.Data
return new Attachment(id, url, fileName, width, height, fileSize);
}
}
}

View file

@ -4,8 +4,8 @@ using DiscordChatExporter.Core.Discord.Data.Common;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/channel#channel-object
public partial record Channel(
Snowflake Id,
@ -69,4 +69,3 @@ namespace DiscordChatExporter.Core.Discord.Data
);
}
}
}

View file

@ -3,8 +3,8 @@ using DiscordChatExporter.Core.Discord.Data.Common;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
public record ChannelCategory(Snowflake Id, string Name, int? Position) : IHasId
{
public static ChannelCategory Unknown { get; } = new(Snowflake.Zero, "<unknown category>", 0);
@ -24,4 +24,3 @@ namespace DiscordChatExporter.Core.Discord.Data
);
}
}
}

View file

@ -1,5 +1,5 @@
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/channel#channel-object-channel-types
// Order of enum fields needs to match the order in the docs.
public enum ChannelKind
@ -12,4 +12,3 @@
GuildNews,
GuildStore
}
}

View file

@ -1,8 +1,8 @@
using System;
using System.Diagnostics.CodeAnalysis;
namespace DiscordChatExporter.Core.Discord.Data.Common
{
namespace DiscordChatExporter.Core.Discord.Data.Common;
// Loosely based on https://github.com/omar/ByteSize (MIT license)
public readonly partial record struct FileSize(long TotalBytes)
{
@ -46,4 +46,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Common
{
public static FileSize FromBytes(long bytes) => new(bytes);
}
}

View file

@ -1,7 +1,6 @@
namespace DiscordChatExporter.Core.Discord.Data.Common
{
namespace DiscordChatExporter.Core.Discord.Data.Common;
public interface IHasId
{
Snowflake Id { get; }
}
}

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
namespace DiscordChatExporter.Core.Discord.Data.Common
{
namespace DiscordChatExporter.Core.Discord.Data.Common;
public class IdBasedEqualityComparer : IEqualityComparer<IHasId>
{
public static IdBasedEqualityComparer Instance { get; } = new();
@ -10,4 +10,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Common
public int GetHashCode(IHasId obj) => obj.Id.GetHashCode();
}
}

View file

@ -6,8 +6,8 @@ using System.Text.Json;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data.Embeds
{
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
// https://discord.com/developers/docs/resources/channel#embed-object
public partial record Embed(
string? Title,
@ -64,4 +64,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds
);
}
}
}

View file

@ -1,8 +1,8 @@
using System.Text.Json;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data.Embeds
{
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
// https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure
public record EmbedAuthor(
string? Name,
@ -20,4 +20,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds
return new EmbedAuthor(name, url, iconUrl, iconProxyUrl);
}
}
}

View file

@ -2,8 +2,8 @@ using System.Text.Json;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data.Embeds
{
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
// https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure
public record EmbedField(
string Name,
@ -19,4 +19,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds
return new EmbedField(name, value, isInline);
}
}
}

View file

@ -2,8 +2,8 @@ using System.Text.Json;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data.Embeds
{
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
// https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure
public record EmbedFooter(
string Text,
@ -19,4 +19,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds
return new EmbedFooter(text, iconUrl, iconProxyUrl);
}
}
}

View file

@ -1,8 +1,8 @@
using System.Text.Json;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data.Embeds
{
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
// https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure
public record EmbedImage(
string? Url,
@ -20,4 +20,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds
return new EmbedImage(url, proxyUrl, width, height);
}
}
}

View file

@ -3,8 +3,8 @@ using System.Linq;
using System.Text.RegularExpressions;
using DiscordChatExporter.Core.Utils;
namespace DiscordChatExporter.Core.Discord.Data.Embeds
{
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
public record PlainImageEmbedProjection(string Url)
{
public static PlainImageEmbedProjection? TryResolve(Embed embed)
@ -31,4 +31,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds
return new PlainImageEmbedProjection(embed.Url);
}
}
}

View file

@ -1,7 +1,7 @@
using System.Text.RegularExpressions;
namespace DiscordChatExporter.Core.Discord.Data.Embeds
{
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
public partial record SpotifyTrackEmbedProjection(string TrackId)
{
public string Url => $"https://open.spotify.com/embed/track/{TrackId}";
@ -31,4 +31,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds
return new SpotifyTrackEmbedProjection(trackId);
}
}
}

View file

@ -1,7 +1,7 @@
using System.Text.RegularExpressions;
namespace DiscordChatExporter.Core.Discord.Data.Embeds
{
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
public partial record YouTubeVideoEmbedProjection(string VideoId)
{
public string Url => $"https://www.youtube.com/embed/{VideoId}";
@ -46,4 +46,3 @@ namespace DiscordChatExporter.Core.Discord.Data.Embeds
return new YouTubeVideoEmbedProjection(videoId);
}
}
}

View file

@ -4,8 +4,8 @@ using DiscordChatExporter.Core.Utils;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/emoji#emoji-object
public partial record Emoji(
// Only present on custom emoji
@ -57,4 +57,3 @@ namespace DiscordChatExporter.Core.Discord.Data
return new Emoji(id, name, isAnimated, imageUrl);
}
}
}

View file

@ -3,8 +3,8 @@ using DiscordChatExporter.Core.Discord.Data.Common;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/guild#guild-object
public record Guild(Snowflake Id, string Name, string IconUrl) : IHasId
{
@ -33,4 +33,3 @@ namespace DiscordChatExporter.Core.Discord.Data
return new Guild(id, name, iconUrl);
}
}
}

View file

@ -6,8 +6,8 @@ using DiscordChatExporter.Core.Discord.Data.Common;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/guild#guild-member-object
public partial record Member(
User User,
@ -44,4 +44,3 @@ namespace DiscordChatExporter.Core.Discord.Data
);
}
}
}

View file

@ -7,8 +7,8 @@ using DiscordChatExporter.Core.Discord.Data.Embeds;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/channel#message-object
public record Message(
Snowflake Id,
@ -86,4 +86,3 @@ namespace DiscordChatExporter.Core.Discord.Data
);
}
}
}

View file

@ -1,5 +1,5 @@
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/channel#message-object-message-types
public enum MessageKind
{
@ -13,4 +13,3 @@
GuildMemberJoin = 7,
Reply = 19
}
}

View file

@ -2,8 +2,8 @@ using System.Text.Json;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
public record MessageReference(Snowflake? MessageId, Snowflake? ChannelId, Snowflake? GuildId)
{
@ -16,4 +16,3 @@ namespace DiscordChatExporter.Core.Discord.Data
return new MessageReference(messageId, channelId, guildId);
}
}
}

View file

@ -1,8 +1,8 @@
using System.Text.Json;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/channel#reaction-object
public record Reaction(Emoji Emoji, int Count)
{
@ -14,4 +14,3 @@ namespace DiscordChatExporter.Core.Discord.Data
return new Reaction(emoji, count);
}
}
}

View file

@ -4,8 +4,8 @@ using DiscordChatExporter.Core.Discord.Data.Common;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/topics/permissions#role-object
public record Role(Snowflake Id, string Name, int Position, Color? Color) : IHasId
{
@ -25,4 +25,3 @@ namespace DiscordChatExporter.Core.Discord.Data
return new Role(id, name, position, color);
}
}
}

View file

@ -4,8 +4,8 @@ using DiscordChatExporter.Core.Discord.Data.Common;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord.Data
{
namespace DiscordChatExporter.Core.Discord.Data;
// https://discord.com/developers/docs/resources/user#user-object
public partial record User(
Snowflake Id,
@ -48,4 +48,3 @@ namespace DiscordChatExporter.Core.Discord.Data
return new User(id, isBot, discriminator, name, avatarUrl);
}
}
}

View file

@ -14,8 +14,8 @@ using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Http;
using JsonExtensions.Reading;
namespace DiscordChatExporter.Core.Discord
{
namespace DiscordChatExporter.Core.Discord;
public class DiscordClient
{
private readonly AuthToken _token;
@ -300,4 +300,3 @@ namespace DiscordChatExporter.Core.Discord
}
}
}
}

View file

@ -3,8 +3,8 @@ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text.RegularExpressions;
namespace DiscordChatExporter.Core.Discord
{
namespace DiscordChatExporter.Core.Discord;
public readonly partial record struct Snowflake(ulong Value)
{
public DateTimeOffset ToDate() => DateTimeOffset.FromUnixTimeMilliseconds(
@ -53,4 +53,3 @@ namespace DiscordChatExporter.Core.Discord
{
public int CompareTo(Snowflake other) => Value.CompareTo(other.Value);
}
}

View file

@ -1,8 +1,8 @@
using System;
using System.Net.Http;
namespace DiscordChatExporter.Core.Exceptions
{
namespace DiscordChatExporter.Core.Exceptions;
public partial class DiscordChatExporterException : Exception
{
public bool IsFatal { get; }
@ -42,4 +42,3 @@ Failed to perform an HTTP request.
internal static DiscordChatExporterException ChannelIsEmpty() =>
new("No messages found for the specified period.");
}
}

View file

@ -9,8 +9,8 @@ using DiscordChatExporter.Core.Discord.Data.Common;
using DiscordChatExporter.Core.Exceptions;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Core.Exporting
{
namespace DiscordChatExporter.Core.Exporting;
public class ChannelExporter
{
private readonly DiscordClient _discord;
@ -80,4 +80,3 @@ namespace DiscordChatExporter.Core.Exporting
throw DiscordChatExporterException.ChannelIsEmpty();
}
}
}

View file

@ -10,8 +10,8 @@ using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Core.Exporting
{
namespace DiscordChatExporter.Core.Exporting;
internal class ExportContext
{
private readonly MediaDownloader _mediaDownloader;
@ -103,4 +103,3 @@ namespace DiscordChatExporter.Core.Exporting
}
}
}
}

View file

@ -1,7 +1,7 @@
using System;
namespace DiscordChatExporter.Core.Exporting
{
namespace DiscordChatExporter.Core.Exporting;
public enum ExportFormat
{
PlainText,
@ -33,4 +33,3 @@ namespace DiscordChatExporter.Core.Exporting
_ => throw new ArgumentOutOfRangeException(nameof(format))
};
}
}

View file

@ -8,8 +8,8 @@ using DiscordChatExporter.Core.Exporting.Filtering;
using DiscordChatExporter.Core.Exporting.Partitioning;
using DiscordChatExporter.Core.Utils;
namespace DiscordChatExporter.Core.Exporting
{
namespace DiscordChatExporter.Core.Exporting;
public partial record ExportRequest(
Guild Guild,
Channel Channel,
@ -124,4 +124,3 @@ namespace DiscordChatExporter.Core.Exporting
return buffer.ToString();
}
}
}

View file

@ -1,8 +1,7 @@
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal enum BinaryExpressionKind
{
Or,
And
}
}

View file

@ -1,8 +1,8 @@
using System;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal class BinaryExpressionMessageFilter : MessageFilter
{
private readonly MessageFilter _first;
@ -23,4 +23,3 @@ namespace DiscordChatExporter.Core.Exporting.Filtering
_ => throw new InvalidOperationException($"Unknown binary expression kind '{_kind}'.")
};
}
}

View file

@ -2,8 +2,8 @@
using System.Text.RegularExpressions;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal class ContainsMessageFilter : MessageFilter
{
private readonly string _text;
@ -31,4 +31,3 @@ namespace DiscordChatExporter.Core.Exporting.Filtering
)
);
}
}

View file

@ -1,8 +1,8 @@
using System;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal class FromMessageFilter : MessageFilter
{
private readonly string _value;
@ -14,4 +14,3 @@ namespace DiscordChatExporter.Core.Exporting.Filtering
string.Equals(_value, message.Author.FullName, StringComparison.OrdinalIgnoreCase) ||
string.Equals(_value, message.Author.Id.ToString(), StringComparison.OrdinalIgnoreCase);
}
}

View file

@ -3,8 +3,8 @@ using System.Linq;
using System.Text.RegularExpressions;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal class HasMessageFilter : MessageFilter
{
private readonly MessageContentMatchKind _kind;
@ -22,4 +22,3 @@ namespace DiscordChatExporter.Core.Exporting.Filtering
_ => throw new InvalidOperationException($"Unknown message content match kind '{_kind}'.")
};
}
}

View file

@ -2,8 +2,8 @@
using System.Linq;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal class MentionsMessageFilter : MessageFilter
{
private readonly string _value;
@ -16,4 +16,3 @@ namespace DiscordChatExporter.Core.Exporting.Filtering
string.Equals(_value, user.Id.ToString(), StringComparison.OrdinalIgnoreCase)
);
}
}

View file

@ -1,5 +1,5 @@
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal enum MessageContentMatchKind
{
Link,
@ -9,4 +9,3 @@
Image,
Sound
}
}

View file

@ -2,8 +2,8 @@
using DiscordChatExporter.Core.Exporting.Filtering.Parsing;
using Superpower;
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
public abstract partial class MessageFilter
{
public abstract bool IsMatch(Message message);
@ -15,4 +15,3 @@ namespace DiscordChatExporter.Core.Exporting.Filtering
public static MessageFilter Parse(string value) => FilterGrammar.Filter.Parse(value);
}
}

View file

@ -1,7 +1,7 @@
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal class NegatedMessageFilter : MessageFilter
{
private readonly MessageFilter _filter;
@ -10,4 +10,3 @@ namespace DiscordChatExporter.Core.Exporting.Filtering
public override bool IsMatch(Message message) => !_filter.IsMatch(message);
}
}

View file

@ -1,9 +1,8 @@
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Filtering
{
namespace DiscordChatExporter.Core.Exporting.Filtering;
internal class NullMessageFilter : MessageFilter
{
public override bool IsMatch(Message message) => true;
}
}

View file

@ -2,8 +2,8 @@
using Superpower;
using Superpower.Parsers;
namespace DiscordChatExporter.Core.Exporting.Filtering.Parsing
{
namespace DiscordChatExporter.Core.Exporting.Filtering.Parsing;
internal static class FilterGrammar
{
private static readonly TextParser<char> EscapedCharacter =
@ -99,4 +99,3 @@ namespace DiscordChatExporter.Core.Exporting.Filtering.Parsing
public static readonly TextParser<MessageFilter> Filter =
BinaryExpressionFilter.Token().AtEnd();
}
}

View file

@ -10,8 +10,8 @@ using System.Threading.Tasks;
using DiscordChatExporter.Core.Utils;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Core.Exporting
{
namespace DiscordChatExporter.Core.Exporting;
internal partial class MediaDownloader
{
private readonly string _workingDirPath;
@ -47,7 +47,7 @@ namespace DiscordChatExporter.Core.Exporting
using var response = await Http.Client.GetAsync(url, cancellationToken);
await using (var output = File.Create(filePath))
{
await response.Content.CopyToAsync(output);
await response.Content.CopyToAsync(output, cancellationToken);
}
// Try to set the file date according to the last-modified header
@ -107,4 +107,3 @@ namespace DiscordChatExporter.Core.Exporting
return PathEx.EscapePath(fileNameWithoutExtension.Truncate(42) + '-' + urlHash + fileExtension);
}
}
}

View file

@ -5,8 +5,8 @@ using System.Threading.Tasks;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Exporting.Writers;
namespace DiscordChatExporter.Core.Exporting
{
namespace DiscordChatExporter.Core.Exporting;
internal partial class MessageExporter : IAsyncDisposable
{
private readonly ExportContext _context;
@ -102,4 +102,3 @@ namespace DiscordChatExporter.Core.Exporting
};
}
}
}

View file

@ -1,5 +1,5 @@
namespace DiscordChatExporter.Core.Exporting.Partitioning
{
namespace DiscordChatExporter.Core.Exporting.Partitioning;
internal class FileSizePartitionLimit : PartitionLimit
{
private readonly long _limit;
@ -9,4 +9,3 @@
public override bool IsReached(long messagesWritten, long bytesWritten) =>
bytesWritten >= _limit;
}
}

View file

@ -1,5 +1,5 @@
namespace DiscordChatExporter.Core.Exporting.Partitioning
{
namespace DiscordChatExporter.Core.Exporting.Partitioning;
internal class MessageCountPartitionLimit : PartitionLimit
{
private readonly long _limit;
@ -9,4 +9,3 @@
public override bool IsReached(long messagesWritten, long bytesWritten) =>
messagesWritten >= _limit;
}
}

View file

@ -1,7 +1,6 @@
namespace DiscordChatExporter.Core.Exporting.Partitioning
{
namespace DiscordChatExporter.Core.Exporting.Partitioning;
internal class NullPartitionLimit : PartitionLimit
{
public override bool IsReached(long messagesWritten, long bytesWritten) => false;
}
}

View file

@ -2,8 +2,8 @@
using System.Globalization;
using System.Text.RegularExpressions;
namespace DiscordChatExporter.Core.Exporting.Partitioning
{
namespace DiscordChatExporter.Core.Exporting.Partitioning;
public abstract partial class PartitionLimit
{
public abstract bool IsReached(long messagesWritten, long bytesWritten);
@ -60,4 +60,3 @@ namespace DiscordChatExporter.Core.Exporting.Partitioning
public static PartitionLimit Parse(string value, IFormatProvider? formatProvider = null) =>
TryParse(value, formatProvider) ?? throw new FormatException($"Invalid partition limit '{value}'.");
}
}

View file

@ -7,8 +7,8 @@ using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Core.Exporting.Writers
{
namespace DiscordChatExporter.Core.Exporting.Writers;
internal partial class CsvMessageWriter : MessageWriter
{
private readonly TextWriter _writer;
@ -113,4 +113,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers
return $"\"{value}\"";
}
}
}

View file

@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Writers.Html
{
namespace DiscordChatExporter.Core.Exporting.Writers.Html;
// Used for grouping contiguous messages in HTML export
internal partial class MessageGroup
{
@ -58,4 +58,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers.Html
);
}
}
}

View file

@ -1,7 +1,7 @@
using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
namespace DiscordChatExporter.Core.Exporting.Writers.Html
{
namespace DiscordChatExporter.Core.Exporting.Writers.Html;
internal class MessageGroupTemplateContext
{
public ExportContext ExportContext { get; }
@ -17,4 +17,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers.Html
public string FormatMarkdown(string? markdown, bool isJumboAllowed = true) =>
HtmlMarkdownVisitor.Format(ExportContext, markdown ?? "", isJumboAllowed);
}
}

View file

@ -1,5 +1,5 @@
namespace DiscordChatExporter.Core.Exporting.Writers.Html
{
namespace DiscordChatExporter.Core.Exporting.Writers.Html;
internal class PostambleTemplateContext
{
public ExportContext ExportContext { get; }
@ -12,4 +12,3 @@
MessagesWritten = messagesWritten;
}
}
}

View file

@ -1,7 +1,7 @@
using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
namespace DiscordChatExporter.Core.Exporting.Writers.Html
{
namespace DiscordChatExporter.Core.Exporting.Writers.Html;
internal class PreambleTemplateContext
{
public ExportContext ExportContext { get; }
@ -17,4 +17,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers.Html
public string FormatMarkdown(string? markdown, bool isJumboAllowed = true) =>
HtmlMarkdownVisitor.Format(ExportContext, markdown ?? "", isJumboAllowed);
}
}

View file

@ -6,8 +6,8 @@ using System.Threading.Tasks;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Exporting.Writers.Html;
namespace DiscordChatExporter.Core.Exporting.Writers
{
namespace DiscordChatExporter.Core.Exporting.Writers;
internal class HtmlMessageWriter : MessageWriter
{
private readonly TextWriter _writer;
@ -93,4 +93,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers
await base.DisposeAsync();
}
}
}

View file

@ -9,8 +9,8 @@ using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
using DiscordChatExporter.Core.Utils.Extensions;
using JsonExtensions.Writing;
namespace DiscordChatExporter.Core.Exporting.Writers
{
namespace DiscordChatExporter.Core.Exporting.Writers;
internal class JsonMessageWriter : MessageWriter
{
private readonly Utf8JsonWriter _writer;
@ -324,4 +324,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers
await base.DisposeAsync();
}
}
}

View file

@ -9,8 +9,8 @@ using DiscordChatExporter.Core.Markdown;
using DiscordChatExporter.Core.Markdown.Parsing;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors
{
namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
internal partial class HtmlMarkdownVisitor : MarkdownVisitor
{
private readonly ExportContext _context;
@ -190,4 +190,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors
return buffer.ToString();
}
}
}

View file

@ -4,8 +4,8 @@ using DiscordChatExporter.Core.Markdown;
using DiscordChatExporter.Core.Markdown.Parsing;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors
{
namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
internal partial class PlainTextMarkdownVisitor : MarkdownVisitor
{
private readonly ExportContext _context;
@ -92,4 +92,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors
return buffer.ToString();
}
}
}

View file

@ -4,8 +4,8 @@ using System.Threading;
using System.Threading.Tasks;
using DiscordChatExporter.Core.Discord.Data;
namespace DiscordChatExporter.Core.Exporting.Writers
{
namespace DiscordChatExporter.Core.Exporting.Writers;
internal abstract class MessageWriter : IAsyncDisposable
{
protected Stream Stream { get; }
@ -34,4 +34,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers
public virtual async ValueTask DisposeAsync() => await Stream.DisposeAsync();
}
}

View file

@ -7,8 +7,8 @@ using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Discord.Data.Embeds;
using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
namespace DiscordChatExporter.Core.Exporting.Writers
{
namespace DiscordChatExporter.Core.Exporting.Writers;
internal class PlainTextMessageWriter : MessageWriter
{
private readonly TextWriter _writer;
@ -177,4 +177,3 @@ namespace DiscordChatExporter.Core.Exporting.Writers
await base.DisposeAsync();
}
}
}

View file

@ -1,7 +1,7 @@
using DiscordChatExporter.Core.Utils;
namespace DiscordChatExporter.Core.Markdown
{
namespace DiscordChatExporter.Core.Markdown;
internal record EmojiNode(
// Only present on custom emoji
string? Id,
@ -21,4 +21,3 @@ namespace DiscordChatExporter.Core.Markdown
{
}
}
}

View file

@ -1,5 +1,5 @@
namespace DiscordChatExporter.Core.Markdown
{
namespace DiscordChatExporter.Core.Markdown;
internal enum FormattingKind
{
Bold,
@ -9,4 +9,3 @@
Spoiler,
Quote
}
}

View file

@ -1,6 +1,5 @@
using System.Collections.Generic;
namespace DiscordChatExporter.Core.Markdown
{
namespace DiscordChatExporter.Core.Markdown;
internal record FormattingNode(FormattingKind Kind, IReadOnlyList<MarkdownNode> Children) : MarkdownNode;
}

View file

@ -1,4 +1,3 @@
namespace DiscordChatExporter.Core.Markdown
{
namespace DiscordChatExporter.Core.Markdown;
internal record InlineCodeBlockNode(string Code) : MarkdownNode;
}

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
namespace DiscordChatExporter.Core.Markdown
{
namespace DiscordChatExporter.Core.Markdown;
internal record LinkNode(
string Url,
IReadOnlyList<MarkdownNode> Children) : MarkdownNode
@ -11,4 +11,3 @@ namespace DiscordChatExporter.Core.Markdown
{
}
}
}

View file

@ -1,4 +1,3 @@
namespace DiscordChatExporter.Core.Markdown
{
namespace DiscordChatExporter.Core.Markdown;
internal abstract record MarkdownNode;
}

Some files were not shown because too many files have changed in this diff Show more