mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 07:43:31 -07:00
Clean up
This commit is contained in:
parent
a91337ccac
commit
8bbb8fa5ee
|
|
@ -8,14 +8,20 @@ internal static class HtmlMessageExtensions
|
||||||
{
|
{
|
||||||
// Message content is hidden if it's a link to an embedded media
|
// Message content is hidden if it's a link to an embedded media
|
||||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/682
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/682
|
||||||
public static bool IsContentHidden(this Message message)
|
extension(Message message)
|
||||||
|
{
|
||||||
|
public bool IsContentHidden()
|
||||||
{
|
{
|
||||||
if (message.Embeds.Count != 1)
|
if (message.Embeds.Count != 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var embed = message.Embeds[0];
|
var embed = message.Embeds[0];
|
||||||
|
|
||||||
return string.Equals(message.Content.Trim(), embed.Url, StringComparison.OrdinalIgnoreCase)
|
return string.Equals(
|
||||||
&& embed.Kind is EmbedKind.Image or EmbedKind.Gifv;
|
message.Content.Trim(),
|
||||||
|
embed.Url,
|
||||||
|
StringComparison.OrdinalIgnoreCase
|
||||||
|
) && embed.Kind is EmbedKind.Image or EmbedKind.Gifv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ namespace DiscordChatExporter.Core.Exporting;
|
||||||
|
|
||||||
internal static class PlainTextMessageExtensions
|
internal static class PlainTextMessageExtensions
|
||||||
{
|
{
|
||||||
public static string GetFallbackContent(this Message message) =>
|
extension(Message message)
|
||||||
|
{
|
||||||
|
public string GetFallbackContent() =>
|
||||||
message.Kind switch
|
message.Kind switch
|
||||||
{
|
{
|
||||||
MessageKind.RecipientAdd => message.MentionedUsers.Any()
|
MessageKind.RecipientAdd => message.MentionedUsers.Any()
|
||||||
|
|
@ -41,3 +43,4 @@ internal static class PlainTextMessageExtensions
|
||||||
_ => message.Content,
|
_ => message.Content,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue