mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-05-11 06:43:49 +00:00
Expand list unwrap to also resolve forum channels to thread posts
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/674ba90d-1778-4427-b50a-30bc50195319 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f6e710909c
commit
ea0b47f26d
@@ -16,7 +16,7 @@ namespace DiscordChatExporter.Cli.Commands;
|
||||
|
||||
[Command(
|
||||
"list unwrap",
|
||||
Description = "Resolves categories in a channel list to their child channels."
|
||||
Description = "Resolves categories and forums in a channel list to their child channels and threads."
|
||||
)]
|
||||
public partial class UnwrapChannelsCommand : DiscordCommandBase
|
||||
{
|
||||
@@ -55,6 +55,7 @@ public partial class UnwrapChannelsCommand : DiscordCommandBase
|
||||
{
|
||||
if (channel.IsCategory)
|
||||
{
|
||||
// Expand category to its child channels
|
||||
var guildChannels =
|
||||
channelsByGuild.GetValueOrDefault(channel.GuildId)
|
||||
?? await Discord.GetGuildChannelsAsync(channel.GuildId, cancellationToken);
|
||||
@@ -67,6 +68,17 @@ public partial class UnwrapChannelsCommand : DiscordCommandBase
|
||||
|
||||
channelsByGuild[channel.GuildId] = guildChannels;
|
||||
}
|
||||
else if (channel.Kind == ChannelKind.GuildForum)
|
||||
{
|
||||
// Expand forum to its thread posts
|
||||
await foreach (
|
||||
var thread in Discord.GetChannelThreadsAsync(
|
||||
[channel],
|
||||
cancellationToken: cancellationToken
|
||||
)
|
||||
)
|
||||
result.Add(thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(channel);
|
||||
|
||||
Reference in New Issue
Block a user