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:
Kwoth
2022-04-17 09:58:30 +02:00
parent 29d94640af
commit 18400dc53a
10 changed files with 104 additions and 23 deletions

View File

@@ -530,7 +530,7 @@ public class UserPunishService : INService, IReadyExecutor
return default;
// if template is an embed, send that embed with replacements
// otherwise, treat template as a regular string with replacements
else if (!SmartText.CreateFrom(template).IsEmbed)
else if (SmartText.CreateFrom(template) is not { IsEmbed: true } or { IsEmbedArray: true })
{
template = JsonConvert.SerializeObject(new
{

View File

@@ -81,8 +81,7 @@ public class HelpService : IExecNoCommand, INService
em.AddField(GetText(strs.requires, guild), string.Join("\n", reqs));
em.AddField(_strings.GetText(strs.usage),
string.Join("\n",
Array.ConvertAll(com.RealRemarksArr(_strings,_medusae, culture, prefix), arg => Format.Code(arg))))
string.Join("\n", com.RealRemarksArr(_strings,_medusae, culture, prefix).Map(arg => Format.Code(arg))))
.WithFooter(GetText(strs.module(com.Module.GetTopLevelModule().Name), guild))
.WithOkColor();