Skip to content

Commit 09d1f35

Browse files
authored
fix(webhook/discord): fixed username cannot be empty error (#35412)
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
1 parent 998b6b8 commit 09d1f35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/webhook/discord.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type (
5757
DiscordPayload struct {
5858
Wait bool `json:"wait"`
5959
Content string `json:"content"`
60-
Username string `json:"username"`
60+
Username string `json:"username,omitempty"`
6161
AvatarURL string `json:"avatar_url,omitempty"`
6262
TTS bool `json:"tts"`
6363
Embeds []DiscordEmbed `json:"embeds"`

0 commit comments

Comments
 (0)