diff --git a/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs b/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs
index ed196daf..7e81f3a7 100644
--- a/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs
+++ b/DiscordChatExporter.Cli/Commands/ExportAllCommand.cs
@@ -31,6 +31,10 @@ namespace DiscordChatExporter.Cli.Commands
await foreach (var channel in Discord.GetGuildChannelsAsync(guild.Id))
{
+ // Skip non-text channels
+ if (!channel.IsTextChannel)
+ continue;
+
channels.Add(channel);
}
}
diff --git a/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs b/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs
index b2db56ac..4b1fee51 100644
--- a/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs
+++ b/DiscordChatExporter.Cli/Commands/ExportDirectMessagesCommand.cs
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System.Linq;
+using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base;
@@ -17,9 +18,10 @@ namespace DiscordChatExporter.Cli.Commands
// Get channel metadata
await console.Output.WriteLineAsync("Fetching channels...");
var channels = await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id);
+ var textChannels = channels.Where(c => c.IsTextChannel).ToArray();
// Export
- await ExportAsync(console, channels);
+ await ExportAsync(console, textChannels);
}
}
}
\ No newline at end of file
diff --git a/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs b/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs
index fb6230d2..8a4daf6e 100644
--- a/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs
+++ b/DiscordChatExporter.Cli/Commands/ExportGuildCommand.cs
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System.Linq;
+using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Infrastructure;
using DiscordChatExporter.Cli.Commands.Base;
@@ -20,9 +21,10 @@ namespace DiscordChatExporter.Cli.Commands
// Get channel metadata
await console.Output.WriteLineAsync("Fetching channels...");
var channels = await Discord.GetGuildChannelsAsync(GuildId);
+ var textChannels = channels.Where(c => c.IsTextChannel).ToArray();
// Export
- await ExportAsync(console, channels);
+ await ExportAsync(console, textChannels);
}
}
}
\ No newline at end of file
diff --git a/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs b/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs
index c0db564d..dc691c32 100644
--- a/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs
+++ b/DiscordChatExporter.Cli/Commands/GetChannelsCommand.cs
@@ -19,7 +19,13 @@ namespace DiscordChatExporter.Cli.Commands
{
var channels = await Discord.GetGuildChannelsAsync(GuildId);
- foreach (var channel in channels.OrderBy(c => c.Category.Position).ThenBy(c => c.Name))
+ var textChannels = channels
+ .Where(c => c.IsTextChannel)
+ .OrderBy(c => c.Category.Position)
+ .ThenBy(c => c.Name)
+ .ToArray();
+
+ foreach (var channel in textChannels)
{
// Channel ID
await console.Output.WriteAsync(channel.Id.ToString());
diff --git a/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs b/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs
index e76dfac1..4845be51 100644
--- a/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs
+++ b/DiscordChatExporter.Cli/Commands/GetDirectMessageChannelsCommand.cs
@@ -16,7 +16,13 @@ namespace DiscordChatExporter.Cli.Commands
{
var channels = await Discord.GetGuildChannelsAsync(Guild.DirectMessages.Id);
- foreach (var channel in channels.OrderBy(c => c.Name))
+ var textChannels = channels
+ .Where(c => c.IsTextChannel)
+ .OrderBy(c => c.Category.Position)
+ .ThenBy(c => c.Name)
+ .ToArray();
+
+ foreach (var channel in textChannels)
{
// Channel ID
await console.Output.WriteAsync(channel.Id.ToString());
diff --git a/DiscordChatExporter.Core/Discord/Data/Channel.cs b/DiscordChatExporter.Core/Discord/Data/Channel.cs
index d0cd5925..bb75ac82 100644
--- a/DiscordChatExporter.Core/Discord/Data/Channel.cs
+++ b/DiscordChatExporter.Core/Discord/Data/Channel.cs
@@ -21,6 +21,8 @@ namespace DiscordChatExporter.Core.Discord.Data
ChannelType.GuildNews or
ChannelType.GuildStore;
+ public bool IsVoiceChannel => !IsTextChannel;
+
public Snowflake GuildId { get; }
public ChannelCategory Category { get; }
diff --git a/DiscordChatExporter.Core/Discord/DiscordClient.cs b/DiscordChatExporter.Core/Discord/DiscordClient.cs
index 3a090708..7fbb11f8 100644
--- a/DiscordChatExporter.Core/Discord/DiscordClient.cs
+++ b/DiscordChatExporter.Core/Discord/DiscordClient.cs
@@ -142,10 +142,6 @@ namespace DiscordChatExporter.Core.Discord
var channel = Channel.Parse(channelJson, category, position);
- // We are only interested in text channels
- if (!channel.IsTextChannel)
- continue;
-
position++;
yield return channel;
diff --git a/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs b/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs
index 4b565d45..973c7786 100644
--- a/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs
+++ b/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/HtmlMarkdownVisitor.cs
@@ -99,11 +99,12 @@ namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors
else if (mention.Kind == MentionKind.Channel)
{
var channel = mentionId?.Pipe(_context.TryGetChannel);
+ var symbol = channel?.IsVoiceChannel == true ? "🔊" : "#";
var name = channel?.Name ?? "deleted-channel";
_buffer
.Append("")
- .Append("#").Append(HtmlEncode(name))
+ .Append(symbol).Append(HtmlEncode(name))
.Append("");
}
else if (mention.Kind == MentionKind.Role)
diff --git a/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs b/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs
index f5aa61e9..a4f6cfce 100644
--- a/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs
+++ b/DiscordChatExporter.Core/Exporting/Writers/MarkdownVisitors/PlainTextMarkdownVisitor.cs
@@ -43,6 +43,10 @@ namespace DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors
var name = channel?.Name ?? "deleted-channel";
_buffer.Append($"#{name}");
+
+ // Voice channel marker
+ if (channel?.IsVoiceChannel == true)
+ _buffer.Append(" [voice]");
}
else if (mention.Kind == MentionKind.Role)
{
diff --git a/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs b/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs
index ca8cd4d5..aa6a4ff0 100644
--- a/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs
+++ b/DiscordChatExporter.Core/Markdown/Parsing/MarkdownParser.cs
@@ -135,7 +135,7 @@ namespace DiscordChatExporter.Core.Markdown.Parsing
// Capture <#123456>
private static readonly IMatcher ChannelMentionNodeMatcher = new RegexMatcher(
- new Regex("<#(\\d+)>", DefaultRegexOptions),
+ new Regex("<#!?(\\d+)>", DefaultRegexOptions),
(_, m) => new MentionNode(m.Groups[1].Value, MentionKind.Channel)
);
diff --git a/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs b/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs
index 1f898e9d..4dcf2018 100644
--- a/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs
+++ b/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs
@@ -168,7 +168,8 @@ namespace DiscordChatExporter.Gui.ViewModels
var guildChannelMap = new Dictionary>();
await foreach (var guild in discord.GetUserGuildsAsync())
{
- guildChannelMap[guild] = await discord.GetGuildChannelsAsync(guild.Id);
+ var channels = await discord.GetGuildChannelsAsync(guild.Id);
+ guildChannelMap[guild] = channels.Where(c => c.IsTextChannel).ToArray();
}
GuildChannelMap = guildChannelMap;