From 9e821689cfc6dad38a37f1561fac108881479d93 Mon Sep 17 00:00:00 2001 From: tyler Date: Fri, 19 Jan 2024 14:19:22 -0500 Subject: [PATCH] Changed struct name to be clearer --- chat.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/chat.go b/chat.go index 3002602..5fc03fd 100644 --- a/chat.go +++ b/chat.go @@ -232,16 +232,16 @@ type ChatEvent struct { Type string `json:"type"` } -type ChatEventDataFix struct { +type ChatEventDataNoChannels struct { Channels [][]string `json:"channels"` Messages []ChatEventMessage `json:"messages"` Users []ChatEventUser `json:"users"` } -type ChatEventFix struct { - Data ChatEventDataFix `json:"data"` - RequestID string `json:"request_id"` - Type string `json:"type"` +type ChatEventNoChannels struct { + Data ChatEventDataNoChannels `json:"data"` + RequestID string `json:"request_id"` + Type string `json:"type"` } func (c *Client) StartChatStream(handle func(cv ChatView), handleError func(err error)) error { @@ -317,14 +317,14 @@ func parseEvent(event []byte) ([]ChatView, error) { var ce ChatEvent err := json.Unmarshal(event, &ce) if err != nil { - var cef ChatEventFix - errFix := json.Unmarshal(event, &cef) - if errFix != nil { + var cenc ChatEventNoChannels + errNC := json.Unmarshal(event, &cenc) + if errNC != nil { return nil, fmt.Errorf("error un-marshaling event: %v", err) } - ce.Data.Messages = cef.Data.Messages - ce.Data.Users = cef.Data.Users + ce.Data.Messages = cenc.Data.Messages + ce.Data.Users = cenc.Data.Users } users := chatUsers(ce.Data.Users)