Skip to content

Commit

Permalink
Update NuGet packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Dec 28, 2023
1 parent 512f181 commit 4e3deb4
Show file tree
Hide file tree
Showing 22 changed files with 144 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="AngleSharp" Version="1.0.7" />
<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="GitHubActionsTestLogger" Version="2.3.3" PrivateAssets="all" />
<PackageReference Include="JsonExtensions" Version="1.2.0" />
Expand All @@ -22,8 +22,8 @@
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="ReflectionMagic" Version="5.0.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
27 changes: 9 additions & 18 deletions DiscordChatExporter.Cli.Tests/Specs/DateRangeSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,12 @@ public async Task I_can_filter_the_export_to_only_include_messages_sent_after_th
new DateTimeOffset(2021, 09, 08, 14, 26, 35, TimeSpan.Zero)
},
o =>
{
return o.Using<DateTimeOffset>(
o.Using<DateTimeOffset>(
ctx =>
ctx.Subject
.Should()
ctx.Subject.Should()
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
)
.WhenTypeIs<DateTimeOffset>();
}
.WhenTypeIs<DateTimeOffset>()
);
}

Expand Down Expand Up @@ -102,15 +99,12 @@ public async Task I_can_filter_the_export_to_only_include_messages_sent_before_t
new DateTimeOffset(2021, 07, 19, 17, 23, 58, TimeSpan.Zero)
},
o =>
{
return o.Using<DateTimeOffset>(
o.Using<DateTimeOffset>(
ctx =>
ctx.Subject
.Should()
ctx.Subject.Should()
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
)
.WhenTypeIs<DateTimeOffset>();
}
.WhenTypeIs<DateTimeOffset>()
);
}

Expand Down Expand Up @@ -153,15 +147,12 @@ public async Task I_can_filter_the_export_to_only_include_messages_sent_between_
new DateTimeOffset(2021, 07, 24, 14, 52, 40, TimeSpan.Zero)
},
o =>
{
return o.Using<DateTimeOffset>(
o.Using<DateTimeOffset>(
ctx =>
ctx.Subject
.Should()
ctx.Subject.Should()
.BeCloseTo(ctx.Expectation, TimeSpan.FromSeconds(1))
)
.WhenTypeIs<DateTimeOffset>();
}
.WhenTypeIs<DateTimeOffset>()
);
}
}
22 changes: 9 additions & 13 deletions DiscordChatExporter.Cli/Commands/Base/DiscordCommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,22 @@ public virtual ValueTask ExecuteAsync(IConsole console)
{
using (console.WithForegroundColor(ConsoleColor.DarkYellow))
{
console
.Error
.WriteLine(
"Warning: Option --bot is deprecated and should not be used. "
+ "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."
);
console.Error.WriteLine(
"Warning: The --bot option is deprecated and should not be used. "
+ "The token type is now inferred automatically. "
+ "Please update your workflows as this option may be completely removed in a future version."
);
}
}
#pragma warning restore CS0618

// Note about interactivity
if (console.IsOutputRedirected)
{
console
.Output
.WriteLine(
"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 ...)."
);
console.Output.WriteLine(
"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;
Expand Down
88 changes: 33 additions & 55 deletions DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,9 @@ await Exporter.ExportChannelAsync(
// Print the result
using (console.WithForegroundColor(ConsoleColor.White))
{
await console
.Output
.WriteLineAsync(
$"Successfully exported {channels.Count - errorsByChannel.Count} channel(s)."
);
await console.Output.WriteLineAsync(
$"Successfully exported {channels.Count - errorsByChannel.Count} channel(s)."
);
}

// Print errors
Expand All @@ -258,11 +256,9 @@ await console

using (console.WithForegroundColor(ConsoleColor.Red))
{
await console
.Error
.WriteLineAsync(
$"Failed to export {errorsByChannel.Count} the following channel(s):"
);
await console.Error.WriteLineAsync(
$"Failed to export {errorsByChannel.Count} the following channel(s):"
);
}

foreach (var (channel, error) in errorsByChannel)
Expand Down Expand Up @@ -324,51 +320,33 @@ public override async ValueTask ExecuteAsync(IConsole console)
// Support Ukraine callout
if (!IsUkraineSupportMessageDisabled)
{
console
.Output
.WriteLine(
"┌────────────────────────────────────────────────────────────────────┐"
);
console
.Output
.WriteLine(
"│ Thank you for supporting Ukraine <3 │"
);
console
.Output
.WriteLine(
"│ │"
);
console
.Output
.WriteLine(
"│ As Russia wages a genocidal war against my country, │"
);
console
.Output
.WriteLine(
"│ I'm grateful to everyone who continues to │"
);
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(
"│ Thank you for supporting Ukraine <3 │"
);
console.Output.WriteLine(
"│ │"
);
console.Output.WriteLine(
"│ As Russia wages a genocidal war against my country, │"
);
console.Output.WriteLine(
"│ I'm grateful to everyone who continues to │"
);
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("");
}

Expand Down
24 changes: 12 additions & 12 deletions DiscordChatExporter.Cli/Commands/ExportAllCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public override async ValueTask ExecuteAsync(IConsole console)
await foreach (var guild in Discord.GetUserGuildsAsync(cancellationToken))
{
// Regular channels
await console
.Output
.WriteLineAsync($"Fetching channels for server '{guild.Name}'...");
await console.Output.WriteLineAsync(
$"Fetching channels for server '{guild.Name}'..."
);

var fetchedChannelsCount = 0;
await console
Expand Down Expand Up @@ -94,9 +94,9 @@ var channel in Discord.GetGuildChannelsAsync(
// Threads
if (ThreadInclusionMode != ThreadInclusionMode.None)
{
await console
.Output
.WriteLineAsync($"Fetching threads for server '{guild.Name}'...");
await console.Output.WriteLineAsync(
$"Fetching threads for server '{guild.Name}'..."
);

var fetchedThreadsCount = 0;
await console
Expand Down Expand Up @@ -126,9 +126,9 @@ var thread in Discord.GetGuildThreadsAsync(
}
);

await console
.Output
.WriteLineAsync($"Fetched {fetchedThreadsCount} thread(s).");
await console.Output.WriteLineAsync(
$"Fetched {fetchedThreadsCount} thread(s)."
);
}
}
}
Expand Down Expand Up @@ -180,9 +180,9 @@ await console

using (console.WithForegroundColor(ConsoleColor.Red))
{
await console
.Error
.WriteLineAsync("Failed to access the following channel(s):");
await console.Error.WriteLineAsync(
"Failed to access the following channel(s):"
);
}

foreach (var dumpChannel in inaccessibleChannels)
Expand Down
20 changes: 9 additions & 11 deletions DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ await Discord.GetGuildThreadsAsync(
foreach (var channel in channels)
{
// Channel ID
await console
.Output
.WriteAsync(channel.Id.ToString().PadRight(channelIdMaxLength, ' '));
await console.Output.WriteAsync(
channel.Id.ToString().PadRight(channelIdMaxLength, ' ')
);

// Separator
using (console.WithForegroundColor(ConsoleColor.DarkGray))
Expand All @@ -88,11 +88,9 @@ await console
await console.Output.WriteAsync(" * ");

// Thread ID
await console
.Output
.WriteAsync(
channelThread.Id.ToString().PadRight(channelThreadIdMaxLength, ' ')
);
await console.Output.WriteAsync(
channelThread.Id.ToString().PadRight(channelThreadIdMaxLength, ' ')
);

// Separator
using (console.WithForegroundColor(ConsoleColor.DarkGray))
Expand All @@ -108,9 +106,9 @@ await console

// Thread status
using (console.WithForegroundColor(ConsoleColor.White))
await console
.Output
.WriteLineAsync(channelThread.IsArchived ? "Archived" : "Active");
await console.Output.WriteLineAsync(
channelThread.IsArchived ? "Archived" : "Active"
);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions DiscordChatExporter.Cli/Commands/GetDirectChannelsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id, cancellationToken)
foreach (var channel in channels)
{
// Channel ID
await console
.Output
.WriteAsync(channel.Id.ToString().PadRight(channelIdMaxLength, ' '));
await console.Output.WriteAsync(
channel.Id.ToString().PadRight(channelIdMaxLength, ' ')
);

// Separator
using (console.WithForegroundColor(ConsoleColor.DarkGray))
Expand Down
36 changes: 15 additions & 21 deletions DiscordChatExporter.Cli/Commands/GuideCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ public ValueTask ExecuteAsync(IConsole console)
using (console.WithForegroundColor(ConsoleColor.White))
console.Output.WriteLine("To get the token for your personal account:");

console
.Output
.WriteLine(
" * Automating user accounts is technically against TOS — USE AT YOUR OWN RISK!"
);
console.Output.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(" 2. Open any server or direct message channel");
console.Output.WriteLine(" 3. Press Ctrl+Shift+I to show developer tools");
Expand All @@ -40,11 +38,9 @@ public ValueTask ExecuteAsync(IConsole console)
console.Output.WriteLine(" 2. Open your application's settings");
console.Output.WriteLine(" 3. Navigate to the Bot section on the left");
console.Output.WriteLine(" 4. Under Token click Copy");
console
.Output
.WriteLine(
" * Your bot needs to have the Message Content Intent enabled to read messages"
);
console.Output.WriteLine(
" * Your bot needs to have the Message Content Intent enabled to read messages"
);
console.Output.WriteLine();

// Guild or channel ID
Expand All @@ -55,26 +51,24 @@ public ValueTask ExecuteAsync(IConsole console)
console.Output.WriteLine(" 2. Open Settings");
console.Output.WriteLine(" 3. Go to Advanced section");
console.Output.WriteLine(" 4. Enable Developer Mode");
console
.Output
.WriteLine(
" 5. Right-click on the desired server or channel and click Copy Server ID or Copy Channel ID"
);
console.Output.WriteLine(
" 5. Right-click on the desired server or channel and click Copy Server ID or Copy Channel ID"
);
console.Output.WriteLine();

// Docs link
using (console.WithForegroundColor(ConsoleColor.White))
{
console
.Output
.WriteLine("If you have questions or issues, please refer to the documentation:");
console.Output.WriteLine(
"If you have questions or issues, please refer to the documentation:"
);
}

using (console.WithForegroundColor(ConsoleColor.DarkCyan))
{
console
.Output
.WriteLine("https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs");
console.Output.WriteLine(
"https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs"
);
}

return default;
Expand Down
Loading

0 comments on commit 4e3deb4

Please sign in to comment.