Support listing and exporting voice channels

Closes #874
This commit is contained in:
Oleksii Holub 2022-06-28 18:27:01 +03:00
parent 7b72f473fd
commit 94ef4b6981
12 changed files with 39 additions and 51 deletions

View file

@ -31,13 +31,7 @@ public class ExportAllCommand : ExportCommandBase
continue;
await foreach (var channel in Discord.GetGuildChannelsAsync(guild.Id, cancellationToken))
{
// Skip non-text channels
if (!channel.Kind.IsText())
continue;
channels.Add(channel);
}
}
await base.ExecuteAsync(console, channels);

View file

@ -1,5 +1,4 @@
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base;
@ -19,8 +18,7 @@ public class ExportDirectMessagesCommand : ExportCommandBase
await console.Output.WriteLineAsync("Fetching channels...");
var channels = await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id, cancellationToken);
var textChannels = channels.Where(c => c.Kind.IsText()).ToArray();
await base.ExecuteAsync(console, textChannels);
await base.ExecuteAsync(console, channels);
}
}

View file

@ -1,10 +1,8 @@
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands;
@ -28,8 +26,7 @@ public class ExportGuildCommand : ExportCommandBase
await console.Output.WriteLineAsync("Fetching channels...");
var channels = await Discord.GetGuildChannelsAsync(GuildId, cancellationToken);
var textChannels = channels.Where(c => c.Kind.IsText()).ToArray();
await base.ExecuteAsync(console, textChannels);
await base.ExecuteAsync(console, channels);
}
}

View file

@ -5,7 +5,6 @@ using CliFx.Attributes;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base;
using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Utils.Extensions;
namespace DiscordChatExporter.Cli.Commands;
@ -26,7 +25,6 @@ public class GetChannelsCommand : TokenCommandBase
var cancellationToken = console.RegisterCancellationHandler();
var channels = (await Discord.GetGuildChannelsAsync(GuildId, cancellationToken))
.Where(c => c.Kind.IsText())
.OrderBy(c => c.Category.Position)
.ThenBy(c => c.Name)
.ToArray();

View file

@ -17,7 +17,6 @@ public class GetDirectMessageChannelsCommand : TokenCommandBase
var cancellationToken = console.RegisterCancellationHandler();
var channels = (await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id, cancellationToken))
.Where(c => c.Kind.IsText())
.OrderByDescending(c => c.LastMessageId)
.ThenBy(c => c.Name)
.ToArray();