Add defaults to inits

This commit is contained in:
Tyrrrz 2023-08-21 17:35:10 +03:00
parent eac974cfb1
commit 8236ba7c4d
2 changed files with 4 additions and 4 deletions

View file

@ -24,7 +24,7 @@ public abstract class DiscordCommandBase : ICommand
EnvironmentVariable = "DISCORD_TOKEN_BOT", EnvironmentVariable = "DISCORD_TOKEN_BOT",
Description = "This option doesn't do anything. Kept for backwards compatibility." Description = "This option doesn't do anything. Kept for backwards compatibility."
)] )]
public bool IsBotToken { get; init; } public bool IsBotToken { get; init; } = false;
private DiscordClient? _discordClient; private DiscordClient? _discordClient;
protected DiscordClient Discord => _discordClient ??= new DiscordClient(Token); protected DiscordClient Discord => _discordClient ??= new DiscordClient(Token);

View file

@ -94,13 +94,13 @@ public abstract class ExportCommandBase : DiscordCommandBase
"media", "media",
Description = "Download assets referenced by the export (user avatars, attached files, embedded images, etc.)." Description = "Download assets referenced by the export (user avatars, attached files, embedded images, etc.)."
)] )]
public bool ShouldDownloadAssets { get; init; } public bool ShouldDownloadAssets { get; init; } = false;
[CommandOption( [CommandOption(
"reuse-media", "reuse-media",
Description = "Reuse previously downloaded assets to avoid redundant requests." Description = "Reuse previously downloaded assets to avoid redundant requests."
)] )]
public bool ShouldReuseAssets { get; init; } public bool ShouldReuseAssets { get; init; } = false;
private readonly string? _assetsDirPath; private readonly string? _assetsDirPath;
@ -131,7 +131,7 @@ public abstract class ExportCommandBase : DiscordCommandBase
// Use a converter to accept '1' as 'true' to reuse the existing environment variable // Use a converter to accept '1' as 'true' to reuse the existing environment variable
Converter = typeof(TruthyBooleanBindingConverter) Converter = typeof(TruthyBooleanBindingConverter)
)] )]
public bool IsUkraineSupportMessageDisabled { get; init; } public bool IsUkraineSupportMessageDisabled { get; init; } = false;
private ChannelExporter? _channelExporter; private ChannelExporter? _channelExporter;
protected ChannelExporter Exporter => _channelExporter ??= new ChannelExporter(Discord); protected ChannelExporter Exporter => _channelExporter ??= new ChannelExporter(Discord);