mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-27 08:23:03 +00:00
Remove Channel.ParentNameWithFallback
This commit is contained in:
@@ -200,7 +200,7 @@ public abstract class ExportCommandBase : DiscordCommandBase
|
||||
try
|
||||
{
|
||||
await progressContext.StartTaskAsync(
|
||||
$"{channel.ParentNameWithFallback} / {channel.Name}",
|
||||
channel.GetHierarchicalName(),
|
||||
async progress =>
|
||||
{
|
||||
var guild = await Discord.GetGuildAsync(
|
||||
@@ -263,10 +263,7 @@ public abstract class ExportCommandBase : DiscordCommandBase
|
||||
|
||||
foreach (var (channel, error) in errorsByChannel)
|
||||
{
|
||||
await console.Error.WriteAsync(
|
||||
$"{channel.ParentNameWithFallback} / {channel.Name}: "
|
||||
);
|
||||
|
||||
await console.Error.WriteAsync($"{channel.GetHierarchicalName()}: ");
|
||||
using (console.WithForegroundColor(ConsoleColor.Red))
|
||||
await console.Error.WriteLineAsync(error);
|
||||
}
|
||||
@@ -294,7 +291,7 @@ public abstract class ExportCommandBase : DiscordCommandBase
|
||||
var channel = await Discord.GetChannelAsync(channelId, cancellationToken);
|
||||
|
||||
// Unwrap categories
|
||||
if (channel.Kind == ChannelKind.GuildCategory)
|
||||
if (channel.IsCategory)
|
||||
{
|
||||
var guildChannels =
|
||||
channelsByGuild.GetValueOrDefault(channel.GuildId)
|
||||
|
||||
@@ -60,10 +60,10 @@ public class ExportAllCommand : ExportCommandBase
|
||||
var channel in Discord.GetGuildChannelsAsync(guild.Id, cancellationToken)
|
||||
)
|
||||
{
|
||||
if (channel.Kind == ChannelKind.GuildCategory)
|
||||
if (channel.IsCategory)
|
||||
continue;
|
||||
|
||||
if (!IncludeVoiceChannels && channel.Kind.IsVoice())
|
||||
if (!IncludeVoiceChannels && channel.IsVoice)
|
||||
continue;
|
||||
|
||||
channels.Add(channel);
|
||||
@@ -129,15 +129,15 @@ public class ExportAllCommand : ExportCommandBase
|
||||
|
||||
// Filter out unwanted channels
|
||||
if (!IncludeDirectChannels)
|
||||
channels.RemoveAll(c => c.Kind.IsDirect());
|
||||
channels.RemoveAll(c => c.IsDirect);
|
||||
if (!IncludeGuildChannels)
|
||||
channels.RemoveAll(c => c.Kind.IsGuild());
|
||||
channels.RemoveAll(c => c.IsGuild);
|
||||
if (!IncludeVoiceChannels)
|
||||
channels.RemoveAll(c => c.Kind.IsVoice());
|
||||
channels.RemoveAll(c => c.IsVoice);
|
||||
if (ThreadInclusionMode == ThreadInclusionMode.None)
|
||||
channels.RemoveAll(c => c.Kind.IsThread());
|
||||
channels.RemoveAll(c => c.IsThread);
|
||||
if (ThreadInclusionMode != ThreadInclusionMode.All)
|
||||
channels.RemoveAll(c => c.Kind.IsThread() && c.IsArchived);
|
||||
channels.RemoveAll(c => c is { IsThread: true, IsArchived: true });
|
||||
|
||||
await ExportAsync(console, channels);
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ public class ExportGuildCommand : ExportCommandBase
|
||||
// Regular channels
|
||||
await foreach (var channel in Discord.GetGuildChannelsAsync(GuildId, cancellationToken))
|
||||
{
|
||||
if (channel.Kind == ChannelKind.GuildCategory)
|
||||
if (channel.IsCategory)
|
||||
continue;
|
||||
|
||||
if (!IncludeVoiceChannels && channel.Kind.IsVoice())
|
||||
if (!IncludeVoiceChannels && channel.IsVoice)
|
||||
continue;
|
||||
|
||||
channels.Add(channel);
|
||||
|
||||
@@ -35,8 +35,8 @@ public class GetChannelsCommand : DiscordCommandBase
|
||||
var cancellationToken = console.RegisterCancellationHandler();
|
||||
|
||||
var channels = (await Discord.GetGuildChannelsAsync(GuildId, cancellationToken))
|
||||
.Where(c => c.Kind != ChannelKind.GuildCategory)
|
||||
.Where(c => IncludeVoiceChannels || !c.Kind.IsVoice())
|
||||
.Where(c => !c.IsCategory)
|
||||
.Where(c => IncludeVoiceChannels || !c.IsVoice)
|
||||
.OrderBy(c => c.Parent?.Position)
|
||||
.ThenBy(c => c.Name)
|
||||
.ToArray();
|
||||
@@ -72,11 +72,9 @@ public class GetChannelsCommand : DiscordCommandBase
|
||||
using (console.WithForegroundColor(ConsoleColor.DarkGray))
|
||||
await console.Output.WriteAsync(" | ");
|
||||
|
||||
// Channel category / name
|
||||
// Channel name
|
||||
using (console.WithForegroundColor(ConsoleColor.White))
|
||||
await console.Output.WriteLineAsync(
|
||||
$"{channel.ParentNameWithFallback} / {channel.Name}"
|
||||
);
|
||||
await console.Output.WriteLineAsync(channel.GetHierarchicalName());
|
||||
|
||||
var channelThreads = threads.Where(t => t.Parent?.Id == channel.Id).ToArray();
|
||||
var channelThreadIdMaxLength = channelThreads
|
||||
|
||||
@@ -21,7 +21,6 @@ public class GetDirectChannelsCommand : DiscordCommandBase
|
||||
var channels = (
|
||||
await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id, cancellationToken)
|
||||
)
|
||||
.Where(c => c.Kind != ChannelKind.GuildCategory)
|
||||
.OrderByDescending(c => c.LastMessageId)
|
||||
.ThenBy(c => c.Name)
|
||||
.ToArray();
|
||||
@@ -42,11 +41,9 @@ public class GetDirectChannelsCommand : DiscordCommandBase
|
||||
using (console.WithForegroundColor(ConsoleColor.DarkGray))
|
||||
await console.Output.WriteAsync(" | ");
|
||||
|
||||
// Channel category / name
|
||||
// Channel name
|
||||
using (console.WithForegroundColor(ConsoleColor.White))
|
||||
await console.Output.WriteLineAsync(
|
||||
$"{channel.ParentNameWithFallback} / {channel.Name}"
|
||||
);
|
||||
await console.Output.WriteLineAsync(channel.GetHierarchicalName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user