From 26473a532093c0fb5931fce0e6696e4510212ee4 Mon Sep 17 00:00:00 2001 From: eatmoreapple <15055461510@163.com> Date: Fri, 17 Dec 2021 10:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Message.Raw=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=AD=98=E5=82=A8=E6=B6=88=E6=81=AF=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- message.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/message.go b/message.go index ea2d86e..9114a8d 100644 --- a/message.go +++ b/message.go @@ -2,6 +2,7 @@ package openwechat import ( "context" + "encoding/json" "encoding/xml" "errors" "fmt" @@ -52,6 +53,7 @@ type Message struct { mu sync.RWMutex Context context.Context `json:"-"` item map[string]interface{} + Raw []byte `json:"-"` } // Sender 获取消息的发送者 @@ -382,7 +384,8 @@ func (m *Message) Get(key string) (value interface{}, exist bool) { // 消息初始化,根据不同的消息作出不同的处理 func (m *Message) init(bot *Bot) { m.Bot = bot - + raw, _ := json.Marshal(m) + m.Raw = raw // 如果是群消息 if m.IsSendByGroup() { // 将Username和正文分开