mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
34 lines
759 B
C#
34 lines
759 B
C#
#nullable disable
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace NadekoBot;
|
|
|
|
public sealed record SmartEmbedTextArray : SmartText
|
|
{
|
|
public string Content { get; set; }
|
|
public SmartEmbedArrayElementText[] Embeds { get; set; }
|
|
|
|
[JsonIgnore]
|
|
public bool IsValid
|
|
=> Embeds?.All(x => x.IsValid) ?? false;
|
|
|
|
public EmbedBuilder[] GetEmbedBuilders()
|
|
{
|
|
if (Embeds is null)
|
|
return Array.Empty<EmbedBuilder>();
|
|
|
|
return Embeds
|
|
.Where(x => x.IsValid)
|
|
.Select(em => em.GetEmbed())
|
|
.ToArray();
|
|
}
|
|
|
|
public void NormalizeFields()
|
|
{
|
|
if (Embeds is null)
|
|
return;
|
|
|
|
foreach(var eb in Embeds)
|
|
eb.NormalizeFields();
|
|
}
|
|
} |