From dd9a42a135ee9d0caf293c084f2a6667ef638b2e Mon Sep 17 00:00:00 2001 From: tyler Date: Fri, 29 Dec 2023 10:29:37 -0500 Subject: [PATCH] Made chat as channel optional --- chat.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chat.go b/chat.go index eb3174a..ad23c52 100644 --- a/chat.go +++ b/chat.go @@ -82,7 +82,7 @@ type ChatRequest struct { Data ChatData `json:"data"` } -func (c *Client) Chat(message string) error { +func (c *Client) Chat(asChannel bool, message string) error { if c.httpClient == nil { return pkgErr("", fmt.Errorf("http client is nil")) } @@ -103,9 +103,13 @@ func (c *Client) Chat(message string) error { Text: message, }, Rant: nil, - ChannelID: &chatInfo.ChannelID, + ChannelID: nil, }, } + if asChannel { + body.Data.ChannelID = &chatInfo.ChannelID + } + bodyB, err := json.Marshal(body) if err != nil { return pkgErr("error marshaling request body into json", err)