mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-28 08:46:44 +00:00
Add support for extracting channels from data dump in exportall
Closes #597
This commit is contained in:
@@ -7,7 +7,7 @@ using DiscordChatExporter.Core.Discord;
|
||||
|
||||
namespace DiscordChatExporter.Cli.Commands.Base;
|
||||
|
||||
public abstract class TokenCommandBase : ICommand
|
||||
public abstract class DiscordCommandBase : ICommand
|
||||
{
|
||||
[CommandOption(
|
||||
"token",
|
||||
@@ -20,7 +20,7 @@ using Gress;
|
||||
|
||||
namespace DiscordChatExporter.Cli.Commands.Base;
|
||||
|
||||
public abstract class ExportCommandBase : TokenCommandBase
|
||||
public abstract class ExportCommandBase : DiscordCommandBase
|
||||
{
|
||||
private readonly string _outputPath = Directory.GetCurrentDirectory();
|
||||
|
||||
@@ -268,7 +268,7 @@ public abstract class ExportCommandBase : TokenCommandBase
|
||||
await console.Output.WriteLineAsync("Resolving channel(s)...");
|
||||
|
||||
var channels = new List<Channel>();
|
||||
var guildChannelMap = new Dictionary<Snowflake, IReadOnlyList<Channel>>();
|
||||
var channelsByGuild = new Dictionary<Snowflake, IReadOnlyList<Channel>>();
|
||||
|
||||
foreach (var channelId in channelIds)
|
||||
{
|
||||
@@ -278,7 +278,7 @@ public abstract class ExportCommandBase : TokenCommandBase
|
||||
if (channel.Kind == ChannelKind.GuildCategory)
|
||||
{
|
||||
var guildChannels =
|
||||
guildChannelMap.GetValueOrDefault(channel.GuildId) ??
|
||||
channelsByGuild.GetValueOrDefault(channel.GuildId) ??
|
||||
await Discord.GetGuildChannelsAsync(channel.GuildId, cancellationToken);
|
||||
|
||||
foreach (var guildChannel in guildChannels)
|
||||
@@ -288,7 +288,7 @@ public abstract class ExportCommandBase : TokenCommandBase
|
||||
}
|
||||
|
||||
// Cache the guild channels to avoid redundant work
|
||||
guildChannelMap[channel.GuildId] = guildChannels;
|
||||
channelsByGuild[channel.GuildId] = guildChannels;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user