mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-03-13 02:12:59 +00:00
Add --include-threads and --include-archived-threads to exportguild
Related to #1119
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using CliFx.Attributes;
|
||||
using CliFx.Exceptions;
|
||||
using CliFx.Infrastructure;
|
||||
using DiscordChatExporter.Cli.Commands.Base;
|
||||
using DiscordChatExporter.Core.Discord;
|
||||
@@ -28,18 +29,28 @@ public class GetChannelsCommand : DiscordCommandBase
|
||||
|
||||
[CommandOption(
|
||||
"include-threads",
|
||||
Description = "Include threads in the output."
|
||||
Description = "Include threads."
|
||||
)]
|
||||
public bool IncludeThreads { get; init; }
|
||||
public bool IncludeThreads { get; init; } = false;
|
||||
|
||||
[CommandOption(
|
||||
"include-archived-threads",
|
||||
Description = "Include archived threads in the output."
|
||||
Description = "Include archived threads."
|
||||
)]
|
||||
public bool IncludeArchivedThreads { get; init; }
|
||||
public bool IncludeArchivedThreads { get; init; } = false;
|
||||
|
||||
public override async ValueTask ExecuteAsync(IConsole console)
|
||||
{
|
||||
await base.ExecuteAsync(console);
|
||||
|
||||
// Cannot include archived threads without including active threads as well
|
||||
if (IncludeArchivedThreads && !IncludeThreads)
|
||||
{
|
||||
throw new CommandException(
|
||||
"Option --include-archived-threads can only be used when --include-threads is also specified."
|
||||
);
|
||||
}
|
||||
|
||||
var cancellationToken = console.RegisterCancellationHandler();
|
||||
|
||||
var channels = (await Discord.GetGuildChannelsAsync(GuildId, cancellationToken))
|
||||
|
||||
Reference in New Issue
Block a user