From abb9e6d636a458bb513f51d2ce75000b160269d6 Mon Sep 17 00:00:00 2001 From: scjtqs Date: Sun, 6 Sep 2020 10:40:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=20xml=E5=92=8Cjson=E7=9A=84=20=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5=E7=B1=BB=E5=9E=8B=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- message/message.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/message/message.go b/message/message.go index e120a9ab..313addd9 100644 --- a/message/message.go +++ b/message/message.go @@ -502,7 +502,12 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement { if elem.RichMsg.ServiceId == 33 { continue // 前面一个 elem 已经解析到链接 } - res = append(res, NewText(content)) + if isOk := strings.Contains(content, " Date: Sun, 6 Sep 2020 10:50:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=A5=E8=B0=A8=E4=B8=80=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=E6=A0=A1=E9=AA=8C=E4=B8=8Bjson=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E5=AF=8C=E6=96=87=E6=9C=AC=EF=BC=8C=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E9=9D=9Exml=E5=92=8Cjson=E7=9A=84=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=20=E5=86=99=E5=85=A5text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 1 + message/message.go | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 0bf68ec6..2006d99e 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,6 @@ go 1.14 require ( github.com/golang/protobuf v1.4.2 + github.com/tidwall/gjson v1.6.1 // indirect google.golang.org/protobuf v1.25.0 ) diff --git a/message/message.go b/message/message.go index 313addd9..0362f569 100644 --- a/message/message.go +++ b/message/message.go @@ -6,6 +6,7 @@ import ( "github.com/Mrs4s/MiraiGo/client/pb/msg" "github.com/Mrs4s/MiraiGo/utils" "github.com/golang/protobuf/proto" + "github.com/tidwall/gjson" "math" "reflect" "regexp" @@ -504,10 +505,14 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement { } if isOk := strings.Contains(content, "