mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-24 03:36:52 -04:00
Refactor
This commit is contained in:
parent
8d209cd67a
commit
61516feafa
3 changed files with 6 additions and 7 deletions
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
|
namespace DiscordChatExporter.Core.Discord.Data.Embeds;
|
||||||
|
|
||||||
|
@ -10,7 +9,7 @@ public partial record GifvEmbedProjection(string Url)
|
||||||
if (string.IsNullOrWhiteSpace(embed.Url))
|
if (string.IsNullOrWhiteSpace(embed.Url))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (embed.Video is null || string.IsNullOrWhiteSpace(embed.Video.Url))
|
if (string.IsNullOrWhiteSpace(embed.Video?.Url))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (!string.Equals(embed.Type, "gifv", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(embed.Type, "gifv", StringComparison.OrdinalIgnoreCase))
|
||||||
|
|
|
@ -44,7 +44,7 @@ public record Message(
|
||||||
{
|
{
|
||||||
var embed = embeds[i];
|
var embed = embeds[i];
|
||||||
|
|
||||||
if (embed.Url?.Contains("://twitter.com/") == true)
|
if (embed.Url?.Contains("://twitter.com/", StringComparison.OrdinalIgnoreCase) == true)
|
||||||
{
|
{
|
||||||
// Find embeds with the same URL that only contain a single image and nothing else
|
// Find embeds with the same URL that only contain a single image and nothing else
|
||||||
var trailingEmbeds = embeds
|
var trailingEmbeds = embeds
|
||||||
|
|
|
@ -211,12 +211,12 @@
|
||||||
// Gifv embed
|
// Gifv embed
|
||||||
if (embed.TryGetGifv() is { } gifvEmbed)
|
if (embed.TryGetGifv() is { } gifvEmbed)
|
||||||
{
|
{
|
||||||
@if (embed.Video is not null && !string.IsNullOrWhiteSpace(embed.Video.Url) && embed.Thumbnail is not null)
|
@if (!string.IsNullOrWhiteSpace(embed.Video?.Url))
|
||||||
{
|
{
|
||||||
<div class="chatlog__attachment">
|
<div class="chatlog__attachment">
|
||||||
<video class="chatlog__attachment-media" poster="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)" loop onmouseover="this.play()" onmouseout="this.pause()" width="@embed.Video.Width" height="@embed.Video.Height">
|
<video class="chatlog__attachment-media" loop width="@embed.Video.Width" height="@embed.Video.Height" onmouseover="this.play()" onmouseout="this.pause()">
|
||||||
<source src="@await ResolveUrlAsync(embed.Video.ProxyUrl ?? embed.Video.Url)" alt="@(embed.Description ?? "Tenor GIF")" title="@embed.Title">
|
<source src="@await ResolveUrlAsync(embed.Video.ProxyUrl ?? embed.Video.Url)" alt="Embedded video">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue