Skip to content

Commit

Permalink
fix(Button): omit empty Emoji field
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed Jan 10, 2024
1 parent b14883a commit 3215001
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,20 @@ func (b Button) MarshalJSON() ([]byte, error) {
b.Style = PrimaryButton
}

var emoji *ComponentEmoji

if b.Emoji.ID != "" || b.Emoji.Name != "" {
emoji = &b.Emoji
}

return Marshal(struct {
button
Type ComponentType `json:"type"`
Type ComponentType `json:"type"`
Emoji *ComponentEmoji `json:"emoji,omitempty"`
}{
button: button(b),
Type: b.Type(),
Emoji: emoji,
})
}

Expand Down

0 comments on commit 3215001

Please sign in to comment.