Refactor more

This commit is contained in:
Alexey Golub 2020-04-22 21:59:10 +03:00
parent dc79813ad7
commit 88a4fa792b
26 changed files with 117 additions and 99 deletions

View file

@ -29,14 +29,14 @@ namespace DiscordChatExporter.Cli.Commands.Base
[CommandOption("dateformat", Description = "Date format used in output.")]
public string DateFormat { get; set; } = "dd-MMM-yy hh:mm tt";
protected Exporter GetExporter() => new Exporter(GetDiscordClient());
protected ChannelExporter GetChannelExporter() => new ChannelExporter(GetDiscordClient());
protected async ValueTask ExportAsync(IConsole console, Guild guild, Channel channel)
{
console.Output.Write($"Exporting channel '{channel.Name}'... ");
var progress = console.CreateProgressTicker();
await GetExporter().ExportChatLogAsync(guild, channel,
await GetChannelExporter().ExportAsync(guild, channel,
OutputPath, ExportFormat, DateFormat, PartitionLimit,
After, Before, progress);

View file

@ -46,7 +46,7 @@ namespace DiscordChatExporter.Cli.Commands.Base
{
var guild = await GetDiscordClient().GetGuildAsync(channel.GuildId);
await GetExporter().ExportChatLogAsync(guild, channel,
await GetChannelExporter().ExportAsync(guild, channel,
OutputPath, ExportFormat, DateFormat, PartitionLimit,
After, Before, operation);