Fix AHelp erroring when sending empty avatar and footer icon urls (#13416)

This commit is contained in:
DrSmugleaf
2023-01-10 17:33:38 +01:00
committed by GitHub
parent 30f801b59c
commit 427e586f80

View File

@@ -295,17 +295,17 @@ namespace Content.Server.Administration.Systems
return new WebhookPayload return new WebhookPayload
{ {
Username = username, Username = username,
AvatarUrl = _avatarUrl, AvatarUrl = string.IsNullOrWhiteSpace(_avatarUrl) ? null : _avatarUrl,
Embeds = new List<Embed> Embeds = new List<Embed>
{ {
new Embed new()
{ {
Description = messages, Description = messages,
Color = color, Color = color,
Footer = new EmbedFooter Footer = new EmbedFooter
{ {
Text = $"{serverName} ({round})", Text = $"{serverName} ({round})",
IconUrl = _footerIconUrl, IconUrl = string.IsNullOrWhiteSpace(_footerIconUrl) ? null : _footerIconUrl
}, },
}, },
}, },
@@ -438,7 +438,7 @@ namespace Content.Server.Administration.Systems
public string Username { get; set; } = ""; public string Username { get; set; } = "";
[JsonPropertyName("avatar_url")] [JsonPropertyName("avatar_url")]
public string AvatarUrl { get; set; } = ""; public string? AvatarUrl { get; set; } = "";
[JsonPropertyName("embeds")] [JsonPropertyName("embeds")]
public List<Embed>? Embeds { get; set; } = null; public List<Embed>? Embeds { get; set; } = null;
@@ -479,7 +479,7 @@ namespace Content.Server.Administration.Systems
public string Text { get; set; } = ""; public string Text { get; set; } = "";
[JsonPropertyName("icon_url")] [JsonPropertyName("icon_url")]
public string IconUrl { get; set; } = ""; public string? IconUrl { get; set; }
public EmbedFooter() public EmbedFooter()
{ {