mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-27 03:33:55 +00:00
More refactoring
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user