mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 15:53:30 -07:00
Update NuGet packages
This commit is contained in:
parent
512f181be2
commit
4e3deb409c
|
|
@ -13,7 +13,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AngleSharp" Version="1.0.7" />
|
<PackageReference Include="AngleSharp" Version="1.0.7" />
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="all" />
|
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="all" />
|
||||||
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
|
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
|
||||||
<PackageReference Include="FluentAssertions" Version="6.12.0" />
|
<PackageReference Include="FluentAssertions" Version="6.12.0" />
|
||||||
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" PrivateAssets="all" />
|
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" PrivateAssets="all" />
|
||||||
<PackageReference Include="JsonExtensions" Version="1.2.0" />
|
<PackageReference Include="JsonExtensions" Version="1.2.0" />
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||||
<PackageReference Include="ReflectionMagic" Version="5.0.0" />
|
<PackageReference Include="ReflectionMagic" Version="5.0.0" />
|
||||||
<PackageReference Include="xunit" Version="2.6.3" />
|
<PackageReference Include="xunit" Version="2.6.4" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5" PrivateAssets="all" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" PrivateAssets="all" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -54,15 +54,12 @@ public class DateRangeSpecs
|
||||||
new DateTimeOffset(2021, 09, 08, 14, 26, 35, TimeSpan.Zero)
|
new DateTimeOffset(2021, 09, 08, 14, 26, 35, TimeSpan.Zero)
|
||||||
},
|
},
|
||||||
o =>
|
o =>
|
||||||
{
|
o.Using<DateTimeOffset>(
|
||||||
return o.Using<DateTimeOffset>(
|
|
||||||
ctx =>
|
ctx =>
|
||||||
ctx.Subject
|
ctx.Subject.Should()
|
||||||
.Should()
|
|
||||||
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
|
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
|
||||||
)
|
)
|
||||||
.WhenTypeIs<DateTimeOffset>();
|
.WhenTypeIs<DateTimeOffset>()
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,15 +99,12 @@ public class DateRangeSpecs
|
||||||
new DateTimeOffset(2021, 07, 19, 17, 23, 58, TimeSpan.Zero)
|
new DateTimeOffset(2021, 07, 19, 17, 23, 58, TimeSpan.Zero)
|
||||||
},
|
},
|
||||||
o =>
|
o =>
|
||||||
{
|
o.Using<DateTimeOffset>(
|
||||||
return o.Using<DateTimeOffset>(
|
|
||||||
ctx =>
|
ctx =>
|
||||||
ctx.Subject
|
ctx.Subject.Should()
|
||||||
.Should()
|
|
||||||
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
|
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
|
||||||
)
|
)
|
||||||
.WhenTypeIs<DateTimeOffset>();
|
.WhenTypeIs<DateTimeOffset>()
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,15 +147,12 @@ public class DateRangeSpecs
|
||||||
new DateTimeOffset(2021, 07, 24, 14, 52, 40, TimeSpan.Zero)
|
new DateTimeOffset(2021, 07, 24, 14, 52, 40, TimeSpan.Zero)
|
||||||
},
|
},
|
||||||
o =>
|
o =>
|
||||||
{
|
o.Using<DateTimeOffset>(
|
||||||
return o.Using<DateTimeOffset>(
|
|
||||||
ctx =>
|
ctx =>
|
||||||
ctx.Subject
|
ctx.Subject.Should()
|
||||||
.Should()
|
|
||||||
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
|
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
|
||||||
)
|
)
|
||||||
.WhenTypeIs<DateTimeOffset>();
|
.WhenTypeIs<DateTimeOffset>()
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,11 @@ public abstract class DiscordCommandBase : ICommand
|
||||||
{
|
{
|
||||||
using (console.WithForegroundColor(ConsoleColor.DarkYellow))
|
using (console.WithForegroundColor(ConsoleColor.DarkYellow))
|
||||||
{
|
{
|
||||||
console
|
console.Error.WriteLine(
|
||||||
.Error
|
"Warning: The --bot option is deprecated and should not be used. "
|
||||||
.WriteLine(
|
+ "The token type is now inferred automatically. "
|
||||||
"Warning: Option --bot is deprecated and should not be used. "
|
+ "Please update your workflows as this option may be completely removed in a future version."
|
||||||
+ "The type of the provided token is now inferred automatically. "
|
);
|
||||||
+ "Please update your workflows as this option may be completely removed in a future version."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
|
|
@ -51,12 +49,10 @@ public abstract class DiscordCommandBase : ICommand
|
||||||
// Note about interactivity
|
// Note about interactivity
|
||||||
if (console.IsOutputRedirected)
|
if (console.IsOutputRedirected)
|
||||||
{
|
{
|
||||||
console
|
console.Output.WriteLine(
|
||||||
.Output
|
"Note: Output streams are redirected, rich console interactions are disabled. "
|
||||||
.WriteLine(
|
+ "If you are running this command in Docker, consider allocating a pseudo-terminal for better user experience (docker run -it ...)."
|
||||||
"Note: Output streams are redirected, rich console interactions are disabled. "
|
);
|
||||||
+ "If you are running this command in Docker, consider allocating a pseudo-terminal for better user experience (docker run -it ...)."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return default;
|
return default;
|
||||||
|
|
|
||||||
|
|
@ -244,11 +244,9 @@ public abstract class ExportCommandBase : DiscordCommandBase
|
||||||
// Print the result
|
// Print the result
|
||||||
using (console.WithForegroundColor(ConsoleColor.White))
|
using (console.WithForegroundColor(ConsoleColor.White))
|
||||||
{
|
{
|
||||||
await console
|
await console.Output.WriteLineAsync(
|
||||||
.Output
|
$"Successfully exported {channels.Count - errorsByChannel.Count} channel(s)."
|
||||||
.WriteLineAsync(
|
);
|
||||||
$"Successfully exported {channels.Count - errorsByChannel.Count} channel(s)."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print errors
|
// Print errors
|
||||||
|
|
@ -258,11 +256,9 @@ public abstract class ExportCommandBase : DiscordCommandBase
|
||||||
|
|
||||||
using (console.WithForegroundColor(ConsoleColor.Red))
|
using (console.WithForegroundColor(ConsoleColor.Red))
|
||||||
{
|
{
|
||||||
await console
|
await console.Error.WriteLineAsync(
|
||||||
.Error
|
$"Failed to export {errorsByChannel.Count} the following channel(s):"
|
||||||
.WriteLineAsync(
|
);
|
||||||
$"Failed to export {errorsByChannel.Count} the following channel(s):"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (channel, error) in errorsByChannel)
|
foreach (var (channel, error) in errorsByChannel)
|
||||||
|
|
@ -324,51 +320,33 @@ public abstract class ExportCommandBase : DiscordCommandBase
|
||||||
// Support Ukraine callout
|
// Support Ukraine callout
|
||||||
if (!IsUkraineSupportMessageDisabled)
|
if (!IsUkraineSupportMessageDisabled)
|
||||||
{
|
{
|
||||||
console
|
console.Output.WriteLine(
|
||||||
.Output
|
"┌────────────────────────────────────────────────────────────────────┐"
|
||||||
.WriteLine(
|
);
|
||||||
"┌────────────────────────────────────────────────────────────────────┐"
|
console.Output.WriteLine(
|
||||||
);
|
"│ Thank you for supporting Ukraine <3 │"
|
||||||
console
|
);
|
||||||
.Output
|
console.Output.WriteLine(
|
||||||
.WriteLine(
|
"│ │"
|
||||||
"│ Thank you for supporting Ukraine <3 │"
|
);
|
||||||
);
|
console.Output.WriteLine(
|
||||||
console
|
"│ As Russia wages a genocidal war against my country, │"
|
||||||
.Output
|
);
|
||||||
.WriteLine(
|
console.Output.WriteLine(
|
||||||
"│ │"
|
"│ I'm grateful to everyone who continues to │"
|
||||||
);
|
);
|
||||||
console
|
console.Output.WriteLine(
|
||||||
.Output
|
"│ stand with Ukraine in our fight for freedom. │"
|
||||||
.WriteLine(
|
);
|
||||||
"│ As Russia wages a genocidal war against my country, │"
|
console.Output.WriteLine(
|
||||||
);
|
"│ │"
|
||||||
console
|
);
|
||||||
.Output
|
console.Output.WriteLine(
|
||||||
.WriteLine(
|
"│ Learn more: https://tyrrrz.me/ukraine │"
|
||||||
"│ I'm grateful to everyone who continues to │"
|
);
|
||||||
);
|
console.Output.WriteLine(
|
||||||
console
|
"└────────────────────────────────────────────────────────────────────┘"
|
||||||
.Output
|
);
|
||||||
.WriteLine(
|
|
||||||
"│ stand with Ukraine in our fight for freedom. │"
|
|
||||||
);
|
|
||||||
console
|
|
||||||
.Output
|
|
||||||
.WriteLine(
|
|
||||||
"│ │"
|
|
||||||
);
|
|
||||||
console
|
|
||||||
.Output
|
|
||||||
.WriteLine(
|
|
||||||
"│ Learn more: https://tyrrrz.me/ukraine │"
|
|
||||||
);
|
|
||||||
console
|
|
||||||
.Output
|
|
||||||
.WriteLine(
|
|
||||||
"└────────────────────────────────────────────────────────────────────┘"
|
|
||||||
);
|
|
||||||
console.Output.WriteLine("");
|
console.Output.WriteLine("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,9 @@ public class ExportAllCommand : ExportCommandBase
|
||||||
await foreach (var guild in Discord.GetUserGuildsAsync(cancellationToken))
|
await foreach (var guild in Discord.GetUserGuildsAsync(cancellationToken))
|
||||||
{
|
{
|
||||||
// Regular channels
|
// Regular channels
|
||||||
await console
|
await console.Output.WriteLineAsync(
|
||||||
.Output
|
$"Fetching channels for server '{guild.Name}'..."
|
||||||
.WriteLineAsync($"Fetching channels for server '{guild.Name}'...");
|
);
|
||||||
|
|
||||||
var fetchedChannelsCount = 0;
|
var fetchedChannelsCount = 0;
|
||||||
await console
|
await console
|
||||||
|
|
@ -94,9 +94,9 @@ public class ExportAllCommand : ExportCommandBase
|
||||||
// Threads
|
// Threads
|
||||||
if (ThreadInclusionMode != ThreadInclusionMode.None)
|
if (ThreadInclusionMode != ThreadInclusionMode.None)
|
||||||
{
|
{
|
||||||
await console
|
await console.Output.WriteLineAsync(
|
||||||
.Output
|
$"Fetching threads for server '{guild.Name}'..."
|
||||||
.WriteLineAsync($"Fetching threads for server '{guild.Name}'...");
|
);
|
||||||
|
|
||||||
var fetchedThreadsCount = 0;
|
var fetchedThreadsCount = 0;
|
||||||
await console
|
await console
|
||||||
|
|
@ -126,9 +126,9 @@ public class ExportAllCommand : ExportCommandBase
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
await console
|
await console.Output.WriteLineAsync(
|
||||||
.Output
|
$"Fetched {fetchedThreadsCount} thread(s)."
|
||||||
.WriteLineAsync($"Fetched {fetchedThreadsCount} thread(s).");
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -180,9 +180,9 @@ public class ExportAllCommand : ExportCommandBase
|
||||||
|
|
||||||
using (console.WithForegroundColor(ConsoleColor.Red))
|
using (console.WithForegroundColor(ConsoleColor.Red))
|
||||||
{
|
{
|
||||||
await console
|
await console.Error.WriteLineAsync(
|
||||||
.Error
|
"Failed to access the following channel(s):"
|
||||||
.WriteLineAsync("Failed to access the following channel(s):");
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var dumpChannel in inaccessibleChannels)
|
foreach (var dumpChannel in inaccessibleChannels)
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,9 @@ public class GetChannelsCommand : DiscordCommandBase
|
||||||
foreach (var channel in channels)
|
foreach (var channel in channels)
|
||||||
{
|
{
|
||||||
// Channel ID
|
// Channel ID
|
||||||
await console
|
await console.Output.WriteAsync(
|
||||||
.Output
|
channel.Id.ToString().PadRight(channelIdMaxLength, ' ')
|
||||||
.WriteAsync(channel.Id.ToString().PadRight(channelIdMaxLength, ' '));
|
);
|
||||||
|
|
||||||
// Separator
|
// Separator
|
||||||
using (console.WithForegroundColor(ConsoleColor.DarkGray))
|
using (console.WithForegroundColor(ConsoleColor.DarkGray))
|
||||||
|
|
@ -88,11 +88,9 @@ public class GetChannelsCommand : DiscordCommandBase
|
||||||
await console.Output.WriteAsync(" * ");
|
await console.Output.WriteAsync(" * ");
|
||||||
|
|
||||||
// Thread ID
|
// Thread ID
|
||||||
await console
|
await console.Output.WriteAsync(
|
||||||
.Output
|
channelThread.Id.ToString().PadRight(channelThreadIdMaxLength, ' ')
|
||||||
.WriteAsync(
|
);
|
||||||
channelThread.Id.ToString().PadRight(channelThreadIdMaxLength, ' ')
|
|
||||||
);
|
|
||||||
|
|
||||||
// Separator
|
// Separator
|
||||||
using (console.WithForegroundColor(ConsoleColor.DarkGray))
|
using (console.WithForegroundColor(ConsoleColor.DarkGray))
|
||||||
|
|
@ -108,9 +106,9 @@ public class GetChannelsCommand : DiscordCommandBase
|
||||||
|
|
||||||
// Thread status
|
// Thread status
|
||||||
using (console.WithForegroundColor(ConsoleColor.White))
|
using (console.WithForegroundColor(ConsoleColor.White))
|
||||||
await console
|
await console.Output.WriteLineAsync(
|
||||||
.Output
|
channelThread.IsArchived ? "Archived" : "Active"
|
||||||
.WriteLineAsync(channelThread.IsArchived ? "Archived" : "Active");
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ public class GetDirectChannelsCommand : DiscordCommandBase
|
||||||
foreach (var channel in channels)
|
foreach (var channel in channels)
|
||||||
{
|
{
|
||||||
// Channel ID
|
// Channel ID
|
||||||
await console
|
await console.Output.WriteAsync(
|
||||||
.Output
|
channel.Id.ToString().PadRight(channelIdMaxLength, ' ')
|
||||||
.WriteAsync(channel.Id.ToString().PadRight(channelIdMaxLength, ' '));
|
);
|
||||||
|
|
||||||
// Separator
|
// Separator
|
||||||
using (console.WithForegroundColor(ConsoleColor.DarkGray))
|
using (console.WithForegroundColor(ConsoleColor.DarkGray))
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,9 @@ public class GuideCommand : ICommand
|
||||||
using (console.WithForegroundColor(ConsoleColor.White))
|
using (console.WithForegroundColor(ConsoleColor.White))
|
||||||
console.Output.WriteLine("To get the token for your personal account:");
|
console.Output.WriteLine("To get the token for your personal account:");
|
||||||
|
|
||||||
console
|
console.Output.WriteLine(
|
||||||
.Output
|
" * Automating user accounts is technically against TOS — USE AT YOUR OWN RISK!"
|
||||||
.WriteLine(
|
);
|
||||||
" * Automating user accounts is technically against TOS — USE AT YOUR OWN RISK!"
|
|
||||||
);
|
|
||||||
console.Output.WriteLine(" 1. Open Discord in your web browser and login");
|
console.Output.WriteLine(" 1. Open Discord in your web browser and login");
|
||||||
console.Output.WriteLine(" 2. Open any server or direct message channel");
|
console.Output.WriteLine(" 2. Open any server or direct message channel");
|
||||||
console.Output.WriteLine(" 3. Press Ctrl+Shift+I to show developer tools");
|
console.Output.WriteLine(" 3. Press Ctrl+Shift+I to show developer tools");
|
||||||
|
|
@ -40,11 +38,9 @@ public class GuideCommand : ICommand
|
||||||
console.Output.WriteLine(" 2. Open your application's settings");
|
console.Output.WriteLine(" 2. Open your application's settings");
|
||||||
console.Output.WriteLine(" 3. Navigate to the Bot section on the left");
|
console.Output.WriteLine(" 3. Navigate to the Bot section on the left");
|
||||||
console.Output.WriteLine(" 4. Under Token click Copy");
|
console.Output.WriteLine(" 4. Under Token click Copy");
|
||||||
console
|
console.Output.WriteLine(
|
||||||
.Output
|
" * Your bot needs to have the Message Content Intent enabled to read messages"
|
||||||
.WriteLine(
|
);
|
||||||
" * Your bot needs to have the Message Content Intent enabled to read messages"
|
|
||||||
);
|
|
||||||
console.Output.WriteLine();
|
console.Output.WriteLine();
|
||||||
|
|
||||||
// Guild or channel ID
|
// Guild or channel ID
|
||||||
|
|
@ -55,26 +51,24 @@ public class GuideCommand : ICommand
|
||||||
console.Output.WriteLine(" 2. Open Settings");
|
console.Output.WriteLine(" 2. Open Settings");
|
||||||
console.Output.WriteLine(" 3. Go to Advanced section");
|
console.Output.WriteLine(" 3. Go to Advanced section");
|
||||||
console.Output.WriteLine(" 4. Enable Developer Mode");
|
console.Output.WriteLine(" 4. Enable Developer Mode");
|
||||||
console
|
console.Output.WriteLine(
|
||||||
.Output
|
" 5. Right-click on the desired server or channel and click Copy Server ID or Copy Channel ID"
|
||||||
.WriteLine(
|
);
|
||||||
" 5. Right-click on the desired server or channel and click Copy Server ID or Copy Channel ID"
|
|
||||||
);
|
|
||||||
console.Output.WriteLine();
|
console.Output.WriteLine();
|
||||||
|
|
||||||
// Docs link
|
// Docs link
|
||||||
using (console.WithForegroundColor(ConsoleColor.White))
|
using (console.WithForegroundColor(ConsoleColor.White))
|
||||||
{
|
{
|
||||||
console
|
console.Output.WriteLine(
|
||||||
.Output
|
"If you have questions or issues, please refer to the documentation:"
|
||||||
.WriteLine("If you have questions or issues, please refer to the documentation:");
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (console.WithForegroundColor(ConsoleColor.DarkCyan))
|
using (console.WithForegroundColor(ConsoleColor.DarkCyan))
|
||||||
{
|
{
|
||||||
console
|
console.Output.WriteLine(
|
||||||
.Output
|
"https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs"
|
||||||
.WriteLine("https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs");
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return default;
|
return default;
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CliFx" Version="2.3.5" />
|
<PackageReference Include="CliFx" Version="2.3.5" />
|
||||||
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
|
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
|
||||||
<PackageReference Include="Deorcify" Version="1.0.2" PrivateAssets="all" />
|
<PackageReference Include="Deorcify" Version="1.0.2" PrivateAssets="all" />
|
||||||
<PackageReference Include="DotnetRuntimeBootstrapper" Version="2.5.1" PrivateAssets="all" />
|
<PackageReference Include="DotnetRuntimeBootstrapper" Version="2.5.2" PrivateAssets="all" />
|
||||||
<PackageReference Include="Gress" Version="2.1.1" />
|
<PackageReference Include="Gress" Version="2.1.1" />
|
||||||
<PackageReference Include="Spectre.Console" Version="0.48.0" />
|
<PackageReference Include="Spectre.Console" Version="0.48.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,7 @@ public partial record Message
|
||||||
{
|
{
|
||||||
// Concatenate all images into one embed
|
// Concatenate all images into one embed
|
||||||
var images = embed
|
var images = embed
|
||||||
.Images
|
.Images.Concat(trailingEmbeds.SelectMany(e => e.Images))
|
||||||
.Concat(trailingEmbeds.SelectMany(e => e.Images))
|
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
normalizedEmbeds.Add(embed with { Images = images });
|
normalizedEmbeds.Add(embed with { Images = images });
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,10 @@ public class DiscordClient(string token)
|
||||||
|
|
||||||
// Don't validate because the token can have special characters
|
// Don't validate because the token can have special characters
|
||||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/828
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/828
|
||||||
request
|
request.Headers.TryAddWithoutValidation(
|
||||||
.Headers
|
"Authorization",
|
||||||
.TryAddWithoutValidation(
|
tokenKind == TokenKind.Bot ? $"Bot {token}" : token
|
||||||
"Authorization",
|
);
|
||||||
tokenKind == TokenKind.Bot ? $"Bot {token}" : token
|
|
||||||
);
|
|
||||||
|
|
||||||
var response = await Http.Client.SendAsync(
|
var response = await Http.Client.SendAsync(
|
||||||
request,
|
request,
|
||||||
|
|
@ -57,13 +55,11 @@ public class DiscordClient(string token)
|
||||||
// rate limits and that's just way too much effort.
|
// rate limits and that's just way too much effort.
|
||||||
// https://discord.com/developers/docs/topics/rate-limits
|
// https://discord.com/developers/docs/topics/rate-limits
|
||||||
var remainingRequestCount = response
|
var remainingRequestCount = response
|
||||||
.Headers
|
.Headers.TryGetValue("X-RateLimit-Remaining")
|
||||||
.TryGetValue("X-RateLimit-Remaining")
|
|
||||||
?.Pipe(s => int.Parse(s, CultureInfo.InvariantCulture));
|
?.Pipe(s => int.Parse(s, CultureInfo.InvariantCulture));
|
||||||
|
|
||||||
var resetAfterDelay = response
|
var resetAfterDelay = response
|
||||||
.Headers
|
.Headers.TryGetValue("X-RateLimit-Reset-After")
|
||||||
.TryGetValue("X-RateLimit-Reset-After")
|
|
||||||
?.Pipe(s => double.Parse(s, CultureInfo.InvariantCulture))
|
?.Pipe(s => double.Parse(s, CultureInfo.InvariantCulture))
|
||||||
.Pipe(TimeSpan.FromSeconds);
|
.Pipe(TimeSpan.FromSeconds);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AsyncKeyedLock" Version="6.2.4" />
|
<PackageReference Include="AsyncKeyedLock" Version="6.2.4" />
|
||||||
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
|
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
|
||||||
<PackageReference Include="Gress" Version="2.1.1" />
|
<PackageReference Include="Gress" Version="2.1.1" />
|
||||||
<PackageReference Include="JsonExtensions" Version="1.2.0" />
|
<PackageReference Include="JsonExtensions" Version="1.2.0" />
|
||||||
<PackageReference Include="Polly" Version="8.2.0" />
|
<PackageReference Include="Polly" Version="8.2.0" />
|
||||||
<PackageReference Include="RazorBlade" Version="0.5.0" />
|
<PackageReference Include="RazorBlade" Version="0.5.0" />
|
||||||
<PackageReference Include="Superpower" Version="3.0.0" />
|
<PackageReference Include="Superpower" Version="3.0.0" />
|
||||||
<PackageReference Include="WebMarkupMin.Core" Version="2.14.0" />
|
<PackageReference Include="WebMarkupMin.Core" Version="2.14.0" />
|
||||||
<PackageReference Include="YoutubeExplode" Version="6.3.9" />
|
<PackageReference Include="YoutubeExplode" Version="6.3.10" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -57,9 +57,7 @@ internal partial class ExportAssetDownloader(string workingDirPath, bool reuse)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var lastModified = response
|
var lastModified = response
|
||||||
.Content
|
.Content.Headers.TryGetValue("Last-Modified")
|
||||||
.Headers
|
|
||||||
.TryGetValue("Last-Modified")
|
|
||||||
?.Pipe(
|
?.Pipe(
|
||||||
s =>
|
s =>
|
||||||
DateTimeOffset.TryParse(
|
DateTimeOffset.TryParse(
|
||||||
|
|
|
||||||
|
|
@ -182,9 +182,10 @@ public partial class ExportRequest
|
||||||
=> before?.ToDate().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)
|
=> before?.ToDate().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)
|
||||||
?? "",
|
?? "",
|
||||||
"%d"
|
"%d"
|
||||||
=> DateTimeOffset
|
=> DateTimeOffset.Now.ToString(
|
||||||
.Now
|
"yyyy-MM-dd",
|
||||||
.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
|
CultureInfo.InvariantCulture
|
||||||
|
),
|
||||||
|
|
||||||
"%%" => "%",
|
"%%" => "%",
|
||||||
_ => m.Value
|
_ => m.Value
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,12 @@ internal class ContainsMessageFilter(string text) : MessageFilter
|
||||||
|
|
||||||
public override bool IsMatch(Message message) =>
|
public override bool IsMatch(Message message) =>
|
||||||
IsMatch(message.Content)
|
IsMatch(message.Content)
|
||||||
|| message
|
|| message.Embeds.Any(
|
||||||
.Embeds
|
e =>
|
||||||
.Any(
|
IsMatch(e.Title)
|
||||||
e =>
|
|| IsMatch(e.Author?.Name)
|
||||||
IsMatch(e.Title)
|
|| IsMatch(e.Description)
|
||||||
|| IsMatch(e.Author?.Name)
|
|| IsMatch(e.Footer?.Text)
|
||||||
|| IsMatch(e.Description)
|
|| e.Fields.Any(f => IsMatch(f.Name) || IsMatch(f.Value))
|
||||||
|| IsMatch(e.Footer?.Text)
|
);
|
||||||
|| e.Fields.Any(f => IsMatch(f.Name) || IsMatch(f.Value))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,11 @@ namespace DiscordChatExporter.Core.Exporting.Filtering;
|
||||||
internal class MentionsMessageFilter(string value) : MessageFilter
|
internal class MentionsMessageFilter(string value) : MessageFilter
|
||||||
{
|
{
|
||||||
public override bool IsMatch(Message message) =>
|
public override bool IsMatch(Message message) =>
|
||||||
message
|
message.MentionedUsers.Any(
|
||||||
.MentionedUsers
|
user =>
|
||||||
.Any(
|
string.Equals(value, user.Name, StringComparison.OrdinalIgnoreCase)
|
||||||
user =>
|
|| string.Equals(value, user.DisplayName, StringComparison.OrdinalIgnoreCase)
|
||||||
string.Equals(value, user.Name, StringComparison.OrdinalIgnoreCase)
|
|| string.Equals(value, user.FullName, StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(value, user.DisplayName, StringComparison.OrdinalIgnoreCase)
|
|| string.Equals(value, user.Id.ToString(), StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(value, user.FullName, StringComparison.OrdinalIgnoreCase)
|
);
|
||||||
|| string.Equals(value, user.Id.ToString(), StringComparison.OrdinalIgnoreCase)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,10 @@ namespace DiscordChatExporter.Core.Exporting.Filtering;
|
||||||
internal class ReactionMessageFilter(string value) : MessageFilter
|
internal class ReactionMessageFilter(string value) : MessageFilter
|
||||||
{
|
{
|
||||||
public override bool IsMatch(Message message) =>
|
public override bool IsMatch(Message message) =>
|
||||||
message
|
message.Reactions.Any(
|
||||||
.Reactions
|
r =>
|
||||||
.Any(
|
string.Equals(value, r.Emoji.Id?.ToString(), StringComparison.OrdinalIgnoreCase)
|
||||||
r =>
|
|| string.Equals(value, r.Emoji.Name, StringComparison.OrdinalIgnoreCase)
|
||||||
string.Equals(value, r.Emoji.Id?.ToString(), StringComparison.OrdinalIgnoreCase)
|
|| string.Equals(value, r.Emoji.Code, StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(value, r.Emoji.Name, StringComparison.OrdinalIgnoreCase)
|
);
|
||||||
|| string.Equals(value, r.Emoji.Code, StringComparison.OrdinalIgnoreCase)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -446,14 +446,12 @@ internal class JsonMessageWriter(Stream stream, ExportContext context)
|
||||||
|
|
||||||
_writer.WriteStartArray("users");
|
_writer.WriteStartArray("users");
|
||||||
await foreach (
|
await foreach (
|
||||||
var user in Context
|
var user in Context.Discord.GetMessageReactionsAsync(
|
||||||
.Discord
|
Context.Request.Channel.Id,
|
||||||
.GetMessageReactionsAsync(
|
message.Id,
|
||||||
Context.Request.Channel.Id,
|
reaction.Emoji,
|
||||||
message.Id,
|
cancellationToken
|
||||||
reaction.Emoji,
|
)
|
||||||
cancellationToken
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_writer.WriteStartObject();
|
_writer.WriteStartObject();
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ internal partial class MessageExporter(ExportContext context) : IAsyncDisposable
|
||||||
// Ensure that the partition limit has not been reached
|
// Ensure that the partition limit has not been reached
|
||||||
if (
|
if (
|
||||||
_writer is not null
|
_writer is not null
|
||||||
&& context
|
&& context.Request.PartitionLimit.IsReached(
|
||||||
.Request
|
_writer.MessagesWritten,
|
||||||
.PartitionLimit
|
_writer.BytesWritten
|
||||||
.IsReached(_writer.MessagesWritten, _writer.BytesWritten)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
await ResetWriterAsync(cancellationToken);
|
await ResetWriterAsync(cancellationToken);
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Cogwheel" Version="2.0.4" />
|
<PackageReference Include="Cogwheel" Version="2.0.4" />
|
||||||
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
|
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
|
||||||
<PackageReference Include="Deorcify" Version="1.0.2" PrivateAssets="all" />
|
<PackageReference Include="Deorcify" Version="1.0.2" PrivateAssets="all" />
|
||||||
<PackageReference Include="DotnetRuntimeBootstrapper" Version="2.5.1" PrivateAssets="all" />
|
<PackageReference Include="DotnetRuntimeBootstrapper" Version="2.5.2" PrivateAssets="all" />
|
||||||
<PackageReference Include="Gress" Version="2.1.1" />
|
<PackageReference Include="Gress" Version="2.1.1" />
|
||||||
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
||||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,7 @@ public partial class SettingsService
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Registry
|
return Registry
|
||||||
.CurrentUser
|
.CurrentUser.OpenSubKey(
|
||||||
.OpenSubKey(
|
|
||||||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -235,8 +235,7 @@ public class DashboardViewModel : PropertyChangedBase
|
||||||
var exporter = new ChannelExporter(_discord);
|
var exporter = new ChannelExporter(_discord);
|
||||||
|
|
||||||
var channelProgressPairs = dialog
|
var channelProgressPairs = dialog
|
||||||
.Channels!
|
.Channels!.Select(c => new { Channel = c, Progress = _progressMuxer.CreateInput() })
|
||||||
.Select(c => new { Channel = c, Progress = _progressMuxer.CreateInput() })
|
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
var successfulExportCount = 0;
|
var successfulExportCount = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue