Fix export JSON detection to use numeric check; rename GuildIds to ServerIds in GetChannelsCommand

Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/ab01ba49-ad07-42ba-b382-27f4d105a92b

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-04 11:33:13 +00:00
committed by GitHub
parent 1835af12d5
commit f6e710909c
2 changed files with 6 additions and 6 deletions

View File

@@ -39,8 +39,8 @@ public partial class ExportChannelsCommand : ExportCommandBase
if (string.IsNullOrEmpty(trimmed))
continue;
// JSON array produced by 'list channels' / 'list channels dm'
if (trimmed.StartsWith('['))
// Snowflake IDs are numeric; non-numeric input is treated as a JSON array
if (!char.IsAsciiDigit(trimmed[0]))
{
using var doc = JsonDocument.Parse(trimmed);
foreach (var element in doc.RootElement.EnumerateArray())

View File

@@ -18,7 +18,7 @@ namespace DiscordChatExporter.Cli.Commands;
public partial class GetChannelsCommand : DiscordCommandBase
{
[CommandParameter(0, Name = "server-ids", Description = "Server ID(s).")]
public required IReadOnlyList<Snowflake> GuildIds { get; set; }
public required IReadOnlyList<Snowflake> ServerIds { get; set; }
[CommandOption("include-vc", Description = "Include voice channels.")]
public bool IncludeVoiceChannels { get; set; } = true;
@@ -38,9 +38,9 @@ public partial class GetChannelsCommand : DiscordCommandBase
var allChannels = new List<Channel>();
foreach (var guildId in GuildIds)
foreach (var serverId in ServerIds)
{
var channels = (await Discord.GetGuildChannelsAsync(guildId, cancellationToken))
var channels = (await Discord.GetGuildChannelsAsync(serverId, cancellationToken))
.Where(c => !c.IsCategory)
.Where(c => IncludeVoiceChannels || !c.IsVoice)
.OrderBy(c => c.Parent?.Position)
@@ -51,7 +51,7 @@ public partial class GetChannelsCommand : DiscordCommandBase
ThreadInclusionMode != ThreadInclusionMode.None
? (
await Discord.GetGuildThreadsAsync(
guildId,
serverId,
ThreadInclusionMode == ThreadInclusionMode.All,
null,
null,