From d193cbd641ea238444fc54a36c7885170fed2cba Mon Sep 17 00:00:00 2001 From: eatmoreapple <15055461510@163.com> Date: Wed, 29 Dec 2021 18:11:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B6=88=E6=81=AF=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E5=86=85=E5=AE=B9=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- message.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/message.go b/message.go index 9248933..615c7c6 100644 --- a/message.go +++ b/message.go @@ -54,6 +54,7 @@ type Message struct { Context context.Context `json:"-"` item map[string]interface{} Raw []byte `json:"-"` + RowContent string `json:"-"` // 消息原始内容 } // Sender 获取消息的发送者 @@ -389,6 +390,7 @@ func (m *Message) init(bot *Bot) { m.Bot = bot raw, _ := json.Marshal(m) m.Raw = raw + m.RowContent = m.Content // 如果是群消息 if m.IsSendByGroup() { if !m.IsSystem() { @@ -405,10 +407,11 @@ func (m *Message) init(bot *Bot) { // 判断是不是@消息 atFlag := "@" + displayName + "\u2005" // mac客户端的@是空格非\u2005 - mac_atFlag := "@" + displayName + " " - if strings.Contains(m.Content, atFlag) || strings.Contains(m.Content, mac_atFlag) { + macAtFlag := "@" + displayName + " " + if strings.Contains(m.Content, atFlag) || strings.Contains(m.Content, macAtFlag) { m.isAt = true m.Content = strings.Replace(m.Content, atFlag, "", -1) + m.Content = strings.Replace(m.Content, macAtFlag, "", -1) } } }