From 3c7e7a19dde50c0e7b5d4aaa89aa1e7b272a5e34 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sat, 6 Sep 2025 02:44:39 +0800 Subject: [PATCH] fix(webhook/discord): fixed username cannot be empty error (#35412) (#35417) Backport #35412 by @ulnanlu username field is not required by discord and used to override the default username. sending it as blank causes a 400 error. it should be omitted instead when it's not set. Ref: https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params Closes #35411 Co-authored-by: ulnanlu <220980518+ulnanlu@users.noreply.github.com> --- services/webhook/discord.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/webhook/discord.go b/services/webhook/discord.go index 0e8a9aa67c..b6de41df0a 100644 --- a/services/webhook/discord.go +++ b/services/webhook/discord.go @@ -57,7 +57,7 @@ type ( DiscordPayload struct { Wait bool `json:"wait"` Content string `json:"content"` - Username string `json:"username"` + Username string `json:"username,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` TTS bool `json:"tts"` Embeds []DiscordEmbed `json:"embeds"`