mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-03-31 09:33:03 -06:00
Some checks failed
docker / pack (push) Has been cancelled
docker / deploy (push) Has been cancelled
main / format (push) Has been cancelled
main / test (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, linux-arm) (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, linux-arm64) (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, linux-musl-x64) (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, linux-x64) (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, osx-arm64) (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, osx-x64) (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, win-arm64) (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, win-x64) (push) Has been cancelled
main / pack (DiscordChatExporter.Cli, DiscordChatExporter.Cli, win-x86) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, linux-arm) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, linux-arm64) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, linux-musl-x64) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, linux-x64) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, osx-arm64) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, osx-x64) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, win-arm64) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, win-x64) (push) Has been cancelled
main / pack (DiscordChatExporter.Gui, DiscordChatExporter, win-x86) (push) Has been cancelled
main / release (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, linux-arm) (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, linux-arm64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, linux-musl-x64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, linux-x64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, osx-arm64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, osx-x64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, win-arm64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, win-x64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Cli, DiscordChatExporter.Cli, win-x86) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, linux-arm) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, linux-arm64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, linux-musl-x64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, linux-x64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, osx-arm64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, osx-x64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, win-arm64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, win-x64) (push) Has been cancelled
main / deploy (DiscordChatExporter.Gui, DiscordChatExporter, win-x86) (push) Has been cancelled
main / notify (push) Has been cancelled
* Initial plan * Fix unresolved thread mentions in HTML export (#1261) - Add TryGetChannelAsync to DiscordClient for on-demand channel/thread lookup - Add PopulateChannelAsync to ExportContext with negative caching - Update HtmlMarkdownVisitor to resolve thread mentions on demand Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> * Refactor GetChannelAsync to use TryGetChannelAsync for parent resolution Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> * Add test for thread mention resolution in HTML export Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> * Apply PopulateChannelAsync to PlainTextMarkdownVisitor; add JSON thread mention test Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
78 lines
2.2 KiB
C#
78 lines
2.2 KiB
C#
using System.Threading.Tasks;
|
|
using AngleSharp.Dom;
|
|
using DiscordChatExporter.Cli.Tests.Infra;
|
|
using DiscordChatExporter.Core.Discord;
|
|
using FluentAssertions;
|
|
using Xunit;
|
|
|
|
namespace DiscordChatExporter.Cli.Tests.Specs;
|
|
|
|
public class HtmlMentionSpecs
|
|
{
|
|
[Fact]
|
|
public async Task I_can_export_a_channel_that_contains_a_message_with_a_user_mention()
|
|
{
|
|
// Act
|
|
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
|
ChannelIds.MentionTestCases,
|
|
Snowflake.Parse("866458840245076028")
|
|
);
|
|
|
|
// Assert
|
|
message.Text().Should().Contain("User mention: @Tyrrrz");
|
|
message.InnerHtml.Should().Contain("tyrrrz");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task I_can_export_a_channel_that_contains_a_message_with_a_text_channel_mention()
|
|
{
|
|
// Act
|
|
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
|
ChannelIds.MentionTestCases,
|
|
Snowflake.Parse("866459040480624680")
|
|
);
|
|
|
|
// Assert
|
|
message.Text().Should().Contain("Text channel mention: #mention-tests");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task I_can_export_a_channel_that_contains_a_message_with_a_voice_channel_mention()
|
|
{
|
|
// Act
|
|
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
|
ChannelIds.MentionTestCases,
|
|
Snowflake.Parse("866459175462633503")
|
|
);
|
|
|
|
// Assert
|
|
message.Text().Should().Contain("Voice channel mention: 🔊general");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task I_can_export_a_channel_that_contains_a_message_with_a_role_mention()
|
|
{
|
|
// Act
|
|
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
|
ChannelIds.MentionTestCases,
|
|
Snowflake.Parse("866459254693429258")
|
|
);
|
|
|
|
// Assert
|
|
message.Text().Should().Contain("Role mention: @Role 1");
|
|
}
|
|
|
|
[Fact]
|
|
public async Task I_can_export_a_channel_that_contains_a_message_with_a_thread_mention()
|
|
{
|
|
// Act
|
|
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
|
ChannelIds.MentionTestCases,
|
|
Snowflake.Parse("1474874276828938290")
|
|
);
|
|
|
|
// Assert
|
|
message.Text().Should().Contain("Thread mention: #Thread starting message");
|
|
}
|
|
}
|