Skip to content

Commit 17f842b

Browse files
authored
fix: discord avatar override (#172)
1 parent 6cdfda1 commit 17f842b

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

pkg/services/discord/discord.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func (service *Service) sendItems(items []types.MessageItem, params *types.Param
6363
}
6464

6565
payload.Username = config.Username
66+
payload.AvatarURL = config.Avatar
6667

6768
var payloadBytes []byte
6869
payloadBytes, err = json.Marshal(payload)

pkg/services/discord/discord_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Config struct {
1515
Token string `url:"user"`
1616
Title string `key:"title" default:""`
1717
Username string `key:"username" default:"" desc:"Override the webhook default username"`
18-
AvatarURL string `key:"avatar" default:"" desc:"Override the webhook default avatar"`
18+
Avatar string `key:"avatar,avatarurl" default:"" desc:"Override the webhook default avatar with specified URL"`
1919
Color uint `key:"color" default:"0x50D9ff" desc:"The color of the left border for plain messages" base:"16"`
2020
ColorError uint `key:"colorError" default:"0xd60510" desc:"The color of the left border for error messages" base:"16"`
2121
ColorWarn uint `key:"colorWarn" default:"0xffc441" desc:"The color of the left border for warning messages" base:"16"`

pkg/services/discord/discord_json.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
type WebhookPayload struct {
1212
Embeds []embedItem `json:"embeds"`
1313
Username string `json:"username,omitempty"`
14+
AvatarURL string `json:"avatar_url,omitempty"`
1415
}
1516

1617
// JSON is the actual notification payload

0 commit comments

Comments
 (0)