mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-13 18:58:27 -04:00
Fixed a nullref message when the bot is loading medusae. Added support for multiple embeds in features which support custom embeds in the form of
{plainText:text-here, embeds: [embedObject, embedObject, embedObject]}
This commit is contained in:
28
src/NadekoBot/Common/SmartText/SmartEmbedTextArray.cs
Normal file
28
src/NadekoBot/Common/SmartText/SmartEmbedTextArray.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot;
|
||||
|
||||
public sealed record SmartEmbedTextArray : SmartText
|
||||
{
|
||||
public string PlainText { get; set; }
|
||||
public SmartEmbedText[] Embeds { get; set; }
|
||||
|
||||
public bool IsValid
|
||||
=> Embeds?.All(x => x.IsValid) ?? false;
|
||||
|
||||
public EmbedBuilder[] GetEmbedBuilders()
|
||||
{
|
||||
if (Embeds is null)
|
||||
return Array.Empty<EmbedBuilder>();
|
||||
|
||||
return Embeds.Map(em => em.GetEmbed());
|
||||
}
|
||||
|
||||
public void NormalizeFields()
|
||||
{
|
||||
if (Embeds is null)
|
||||
return;
|
||||
|
||||
foreach(var eb in Embeds)
|
||||
eb.NormalizeFields();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user