mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-03-06 23:16:07 +00:00
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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("<span class=\"mention\">")
|
||||
.Append("#").Append(HtmlEncode(name))
|
||||
.Append(symbol).Append(HtmlEncode(name))
|
||||
.Append("</span>");
|
||||
}
|
||||
else if (mention.Kind == MentionKind.Role)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace DiscordChatExporter.Core.Markdown.Parsing
|
||||
|
||||
// Capture <#123456>
|
||||
private static readonly IMatcher<MarkdownNode> ChannelMentionNodeMatcher = new RegexMatcher<MarkdownNode>(
|
||||
new Regex("<#(\\d+)>", DefaultRegexOptions),
|
||||
new Regex("<#!?(\\d+)>", DefaultRegexOptions),
|
||||
(_, m) => new MentionNode(m.Groups[1].Value, MentionKind.Channel)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user