diff --git a/objects/channel/embed/embed.go b/objects/channel/embed/embed.go index 5f42336..db1944a 100644 --- a/objects/channel/embed/embed.go +++ b/objects/channel/embed/embed.go @@ -7,7 +7,7 @@ type Embed struct { Description string `json:"description,omitempty"` Url string `json:"url,omitempty"` Timestamp *time.Time `json:"timestamp,omitempty"` - Color int `json:"color,omitempty"` + Color *int `json:"color,omitempty"` Footer *EmbedFooter `json:"footer,omitempty"` Image *EmbedImage `json:"image,omitempty"` Thumbnail *EmbedThumbnail `json:"thumbnail,omitempty"` diff --git a/objects/channel/embed/embedbuilder.go b/objects/channel/embed/embedbuilder.go index fd1213c..95ab69f 100644 --- a/objects/channel/embed/embedbuilder.go +++ b/objects/channel/embed/embedbuilder.go @@ -27,10 +27,19 @@ func (e *Embed) SetTimestamp(timestamp time.Time) *Embed { } func (e *Embed) SetColor(color int) *Embed { - e.Color = color + e.Color = &color return e } +func (e *Embed) SetColorPtr(color *int) *Embed { + if color == nil { + e.Color = nil + return e + } + + return e.SetColor(*color) +} + func (e *Embed) SetFooter(text, iconUrl string) *Embed { e.Footer = &EmbedFooter{ Text: text,