diff --git a/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs b/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs index 608adcb..a7ab35d 100644 --- a/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs +++ b/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Linq; +using System.Threading.Tasks; using CliFx.Attributes; using CliFx.Infrastructure; using DiscordChatExporter.Cli.Commands.Base; @@ -17,7 +18,10 @@ public class ExportDirectMessagesCommand : ExportCommandBase var cancellationToken = console.RegisterCancellationHandler(); await console.Output.WriteLineAsync("Fetching channels..."); - var channels = await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id, cancellationToken); + + var channels = (await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id, cancellationToken)) + .Where(c => c.Kind != ChannelKind.GuildCategory) + .ToArray(); await base.ExecuteAsync(console, channels); } diff --git a/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs b/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs index be9fc01..77f4377 100644 --- a/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs +++ b/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs @@ -1,8 +1,10 @@ -using System.Threading.Tasks; +using System.Linq; +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; @@ -25,7 +27,10 @@ public class ExportGuildCommand : ExportCommandBase var cancellationToken = console.RegisterCancellationHandler(); await console.Output.WriteLineAsync("Fetching channels..."); - var channels = await Discord.GetGuildChannelsAsync(GuildId, cancellationToken); + + var channels = (await Discord.GetGuildChannelsAsync(GuildId, cancellationToken)) + .Where(c => c.Kind != ChannelKind.GuildCategory) + .ToArray(); await base.ExecuteAsync(console, channels); } diff --git a/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs b/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs index 1ff1d08..187ef4b 100644 --- a/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs +++ b/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs @@ -5,6 +5,7 @@ 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; @@ -25,6 +26,7 @@ public class GetChannelsCommand : TokenCommandBase var cancellationToken = console.RegisterCancellationHandler(); var channels = (await Discord.GetGuildChannelsAsync(GuildId, cancellationToken)) + .Where(c => c.Kind != ChannelKind.GuildCategory) .OrderBy(c => c.Category.Position) .ThenBy(c => c.Name) .ToArray(); diff --git a/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs b/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs index 03265d1..2d7742a 100644 --- a/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs +++ b/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs @@ -17,6 +17,7 @@ public class GetDirectMessageChannelsCommand : TokenCommandBase var cancellationToken = console.RegisterCancellationHandler(); var channels = (await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id, cancellationToken)) + .Where(c => c.Kind != ChannelKind.GuildCategory) .OrderByDescending(c => c.LastMessageId) .ThenBy(c => c.Name) .ToArray(); diff --git a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs index a0d058f..2209cd7 100644 --- a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs @@ -105,7 +105,11 @@ public class DashboardViewModel : PropertyChangedBase var guildChannelMap = new Dictionary>(); await foreach (var guild in discord.GetUserGuildsAsync()) - guildChannelMap[guild] = await discord.GetGuildChannelsAsync(guild.Id); + { + guildChannelMap[guild] = (await discord.GetGuildChannelsAsync(guild.Id)) + .Where(c => c.Kind != ChannelKind.GuildCategory) + .ToArray(); + } _discord = discord; GuildChannelMap = guildChannelMap;