mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-28 21:54:11 -04:00
Refactor last PR
This commit is contained in:
parent
53cebd82eb
commit
0d2b9e8bc0
2 changed files with 13 additions and 9 deletions
|
@ -12,7 +12,6 @@ namespace DiscordChatExporter.Cli.Commands.Base
|
||||||
{
|
{
|
||||||
public abstract class ExportCommandBase : TokenCommandBase
|
public abstract class ExportCommandBase : TokenCommandBase
|
||||||
{
|
{
|
||||||
|
|
||||||
[CommandOption("output", 'o',
|
[CommandOption("output", 'o',
|
||||||
Description = "Output file or directory path.")]
|
Description = "Output file or directory path.")]
|
||||||
public string OutputPath { get; set; } = Directory.GetCurrentDirectory();
|
public string OutputPath { get; set; } = Directory.GetCurrentDirectory();
|
||||||
|
@ -71,13 +70,6 @@ namespace DiscordChatExporter.Cli.Commands.Base
|
||||||
console.Output.WriteLine("Done.");
|
console.Output.WriteLine("Done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExecuteAsync()
|
|
||||||
{
|
|
||||||
if (ShouldReuseMedia && !ShouldDownloadMedia)
|
|
||||||
{
|
|
||||||
throw new CommandException("The --reuse-media option cannot be used without the --media option.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected async ValueTask ExportAsync(IConsole console, Channel channel)
|
protected async ValueTask ExportAsync(IConsole console, Channel channel)
|
||||||
{
|
{
|
||||||
var guild = await GetDiscordClient().GetGuildAsync(channel.GuildId);
|
var guild = await GetDiscordClient().GetGuildAsync(channel.GuildId);
|
||||||
|
@ -89,5 +81,17 @@ namespace DiscordChatExporter.Cli.Commands.Base
|
||||||
var channel = await GetDiscordClient().GetChannelAsync(channelId);
|
var channel = await GetDiscordClient().GetChannelAsync(channelId);
|
||||||
await ExportAsync(console, channel);
|
await ExportAsync(console, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ValueTask ExecuteAsync(IConsole console)
|
||||||
|
{
|
||||||
|
if (ShouldReuseMedia && !ShouldDownloadMedia)
|
||||||
|
{
|
||||||
|
throw new CommandException(
|
||||||
|
"The --reuse-media option cannot be used without the --media option."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ namespace DiscordChatExporter.Cli.Commands
|
||||||
|
|
||||||
public override async ValueTask ExecuteAsync(IConsole console)
|
public override async ValueTask ExecuteAsync(IConsole console)
|
||||||
{
|
{
|
||||||
base.ExecuteAsync();
|
await base.ExecuteAsync(console);
|
||||||
await ExportAsync(console, ChannelId);
|
await ExportAsync(console, ChannelId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue