From 4656e8248c29e2af9b9294312d3faa52200673d5 Mon Sep 17 00:00:00 2001 From: Manuel Mayer Date: Thu, 11 Apr 2024 22:24:21 +0200 Subject: [PATCH] Fix embeds when value is empty --- src/MacroBot.Core/Services/DiscordService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/MacroBot.Core/Services/DiscordService.cs b/src/MacroBot.Core/Services/DiscordService.cs index 8c2099c..8031b03 100644 --- a/src/MacroBot.Core/Services/DiscordService.cs +++ b/src/MacroBot.Core/Services/DiscordService.cs @@ -458,6 +458,10 @@ public async Task BroadcastWebhookAsync(WebhookItem webhook, WebhookRequest webh var embedFieldBuilders = new List(); foreach (var field in webhookRequestEmbed.Fields) { + if (string.IsNullOrWhiteSpace(field.Name) || string.IsNullOrWhiteSpace(field.Value)) + { + continue; + } var embedFieldBuilder = new EmbedFieldBuilder(); embedFieldBuilder.WithName(field.Name); embedFieldBuilder.WithValue(field.Value);