From 5cd4e2bb7ecb25ea194f091319eca9c2284c3229 Mon Sep 17 00:00:00 2001 From: eatmoreapple <15055461510@163.com> Date: Sat, 25 Sep 2021 20:33:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BAMessage=E6=B7=BB=E5=8A=A0string?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot_test.go | 1 + message.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/bot_test.go b/bot_test.go index 1e1a72d..da5eadb 100644 --- a/bot_test.go +++ b/bot_test.go @@ -39,6 +39,7 @@ func TestLogout(t *testing.T) { func TestMessageHandle(t *testing.T) { bot := DefaultBot(Desktop) bot.MessageHandler = func(msg *Message) { + fmt.Println(msg) if msg.IsText() && msg.Content == "ping" { msg.ReplyText("pong") } diff --git a/message.go b/message.go index 28a6588..6481143 100644 --- a/message.go +++ b/message.go @@ -647,3 +647,7 @@ func (a AppMessageData) IsFile() bool { func (m *Message) IsComeFromGroup() bool { return m.IsSendByGroup() || strings.HasPrefix(m.ToUserName, "@@") } + +func (m *Message) String() string { + return fmt.Sprintf("<%s:ID:%s>", m.MsgType, m.MsgId) +}