From 6feed6f193a29270f471f3af4d6c24be28c5d273 Mon Sep 17 00:00:00 2001 From: Tnze Date: Sun, 2 Jun 2019 20:48:46 +0800 Subject: [PATCH] chat message support json.Marshal --- chat/chatMsg.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/chat/chatMsg.go b/chat/chatMsg.go index 10b8789..7c87855 100644 --- a/chat/chatMsg.go +++ b/chat/chatMsg.go @@ -16,16 +16,16 @@ type Message jsonChat type jsonChat struct { Text string `json:"text"` - Bold bool `json:"bold"` //粗体 - Italic bool `json:"Italic"` //斜体 - UnderLined bool `json:"underlined"` //下划线 - StrikeThrough bool `json:"strikethrough"` //删除线 - Obfuscated bool `json:"obfuscated"` //随机 - Color string `json:"color"` + Bold bool `json:"bold,omitempty"` //粗体 + Italic bool `json:"Italic,omitempty"` //斜体 + UnderLined bool `json:"underlined,omitempty"` //下划线 + StrikeThrough bool `json:"strikethrough,omitempty"` //删除线 + Obfuscated bool `json:"obfuscated,omitempty"` //随机 + Color string `json:"color,omitempty"` - Translate string `json:"translate"` - With []json.RawMessage `json:"with"` // How can go handle an JSON array with Object and String? - Extra []jsonChat `json:"extra"` + Translate string `json:"translate,omitempty"` + With []json.RawMessage `json:"with,omitempty"` // How can go handle an JSON array with Object and String? + Extra []jsonChat `json:"extra,omitempty"` } //UnmarshalJSON decode json to Message