mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-10 18:06:37 +02:00
dotnet format
fixes (only this PR's touched lines)
This commit is contained in:
parent
daff360ce4
commit
f526dbe213
6 changed files with 20 additions and 13 deletions
|
@ -173,8 +173,6 @@ public class DateRangeSpecs
|
|||
.Select(j => j.GetProperty("timestamp").GetDateTimeOffset())
|
||||
.ToArray();
|
||||
|
||||
timestamps
|
||||
.Should()
|
||||
.BeEmpty();
|
||||
timestamps.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,7 +237,8 @@ public abstract class ExportCommandBase : DiscordCommandBase
|
|||
}
|
||||
);
|
||||
}
|
||||
catch (ChannelEmptyException ex) {
|
||||
catch (ChannelEmptyException ex)
|
||||
{
|
||||
warningsByChannel[channel] = ex.Message;
|
||||
}
|
||||
catch (DiscordChatExporterException ex) when (!ex.IsFatal)
|
||||
|
@ -285,9 +286,7 @@ public abstract class ExportCommandBase : DiscordCommandBase
|
|||
|
||||
using (console.WithForegroundColor(ConsoleColor.Red))
|
||||
{
|
||||
await console.Error.WriteLineAsync(
|
||||
$"Failed to export the following channel(s):"
|
||||
);
|
||||
await console.Error.WriteLineAsync($"Failed to export the following channel(s):");
|
||||
}
|
||||
|
||||
foreach (var (channel, message) in errorsByChannel)
|
||||
|
|
|
@ -5,5 +5,5 @@ namespace DiscordChatExporter.Core.Exceptions;
|
|||
// Thrown when there is circumstancially no message to export with given parameters,
|
||||
// though it should not be treated as a runtime error; simply warn instead
|
||||
public class ChannelEmptyException(string message)
|
||||
: DiscordChatExporterException(message, false, null) {
|
||||
}
|
||||
: DiscordChatExporterException(message, false, null)
|
||||
{ }
|
||||
|
|
|
@ -45,8 +45,16 @@ public class ChannelExporter(DiscordClient discord)
|
|||
}
|
||||
|
||||
// Check if the 'before' and 'after' boundaries are valid
|
||||
if ((request.Before is not null && !request.Channel.MayHaveMessagesBefore(request.Before.Value)) ||
|
||||
(request.After is not null && !request.Channel.MayHaveMessagesAfter(request.After.Value)))
|
||||
if (
|
||||
(
|
||||
request.Before is not null
|
||||
&& !request.Channel.MayHaveMessagesBefore(request.Before.Value)
|
||||
)
|
||||
|| (
|
||||
request.After is not null
|
||||
&& !request.Channel.MayHaveMessagesAfter(request.After.Value)
|
||||
)
|
||||
)
|
||||
{
|
||||
throw new ChannelEmptyException(
|
||||
$"Channel '{request.Channel.Name}' "
|
||||
|
|
|
@ -70,7 +70,8 @@ internal partial class MessageExporter(ExportContext context) : IAsyncDisposable
|
|||
MessagesExported++;
|
||||
}
|
||||
|
||||
public async ValueTask DisposeAsync() {
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
// causes the file to be created whether there were messages written or not
|
||||
await GetWriterAsync();
|
||||
await ResetWriterAsync();
|
||||
|
|
|
@ -283,7 +283,8 @@ public partial class DashboardViewModel : ViewModelBase
|
|||
|
||||
Interlocked.Increment(ref successfulExportCount);
|
||||
}
|
||||
catch (ChannelEmptyException ex) {
|
||||
catch (ChannelEmptyException ex)
|
||||
{
|
||||
_snackbarManager.Notify(ex.Message.TrimEnd('.'));
|
||||
|
||||
// FIXME: not exactly successful, but not a failure either. Not ideal to duplicate the line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue