More refactoring

This commit is contained in:
Alexey Golub
2020-04-24 14:18:41 +03:00
parent 9d0d7cd5dd
commit d03be8b1dd
43 changed files with 617 additions and 655 deletions

View File

@@ -1,8 +1,9 @@
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
using CliFx;
using CliFx.Attributes;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Domain.Discord.Models;
using DiscordChatExporter.Domain.Utilities;
namespace DiscordChatExporter.Cli.Commands
{
@@ -11,10 +12,8 @@ namespace DiscordChatExporter.Cli.Commands
{
public override async ValueTask ExecuteAsync(IConsole console)
{
var directMessageChannels = await GetDiscordClient().GetDirectMessageChannelsAsync();
var channels = directMessageChannels.OrderBy(c => c.Name).ToArray();
await ExportMultipleAsync(console, channels);
var dmChannels = await GetDiscordClient().GetGuildChannelsAsync(Guild.DirectMessages.Id);
await ExportMultipleAsync(console, dmChannels);
}
}
}

View File

@@ -1,8 +1,8 @@
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
using CliFx;
using CliFx.Attributes;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Domain.Utilities;
namespace DiscordChatExporter.Cli.Commands
{
@@ -15,13 +15,7 @@ namespace DiscordChatExporter.Cli.Commands
public override async ValueTask ExecuteAsync(IConsole console)
{
var guildChannels = await GetDiscordClient().GetGuildChannelsAsync(GuildId);
var channels = guildChannels
.Where(c => c.IsTextChannel)
.OrderBy(c => c.Name)
.ToArray();
await ExportMultipleAsync(console, channels);
await ExportMultipleAsync(console, guildChannels);
}
}
}

View File

@@ -3,6 +3,7 @@ using System.Threading.Tasks;
using CliFx;
using CliFx.Attributes;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Domain.Utilities;
namespace DiscordChatExporter.Cli.Commands
{
@@ -16,12 +17,7 @@ namespace DiscordChatExporter.Cli.Commands
{
var guildChannels = await GetDiscordClient().GetGuildChannelsAsync(GuildId);
var channels = guildChannels
.Where(c => c.IsTextChannel)
.OrderBy(c => c.Name)
.ToArray();
foreach (var channel in channels)
foreach (var channel in guildChannels.OrderBy(c => c.Name))
console.Output.WriteLine($"{channel.Id} | {channel.Name}");
}
}

View File

@@ -3,6 +3,8 @@ using System.Threading.Tasks;
using CliFx;
using CliFx.Attributes;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Domain.Discord.Models;
using DiscordChatExporter.Domain.Utilities;
namespace DiscordChatExporter.Cli.Commands
{
@@ -11,10 +13,9 @@ namespace DiscordChatExporter.Cli.Commands
{
public override async ValueTask ExecuteAsync(IConsole console)
{
var directMessageChannels = await GetDiscordClient().GetDirectMessageChannelsAsync();
var channels = directMessageChannels.OrderBy(c => c.Name).ToArray();
var dmChannels = await GetDiscordClient().GetGuildChannelsAsync(Guild.DirectMessages.Id);
foreach (var channel in channels)
foreach (var channel in dmChannels.OrderBy(c => c.Name))
console.Output.WriteLine($"{channel.Id} | {channel.Name}");
}
}