From 9b371a7a6b000bd8d5c262d06a2bd857ebc5a5d6 Mon Sep 17 00:00:00 2001 From: eatmoreapple <15055461510@163.com> Date: Sun, 1 Aug 2021 07:50:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0Message=E7=9A=84MsgType?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- message.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/message.go b/message.go index 171dc35..152fdbf 100644 --- a/message.go +++ b/message.go @@ -28,7 +28,7 @@ type Message struct { ImgStatus int ImgWidth int ForwardFlag int - MsgType int + MsgType MessageType Status int StatusNotifyCode int SubMsgType int @@ -149,44 +149,44 @@ func (m *Message) ReplyFile(file *os.File) (*SentMessage, error) { } func (m *Message) IsText() bool { - return m.MsgType == 1 && m.Url == "" + return m.MsgType == MsgtypeText && m.Url == "" } func (m *Message) IsMap() bool { - return m.MsgType == 1 && m.Url != "" + return m.MsgType == MsgtypeText && m.Url != "" } func (m *Message) IsPicture() bool { - return m.MsgType == 3 || m.MsgType == 47 + return m.MsgType == MsgtypeImage || m.MsgType == MsgtypeEmoticon } func (m *Message) IsVoice() bool { - return m.MsgType == 34 + return m.MsgType == MsgtypeVoice } func (m *Message) IsFriendAdd() bool { - return m.MsgType == 37 && m.FromUserName == "fmessage" + return m.MsgType == MsgtypeVerifymsg && m.FromUserName == "fmessage" } func (m *Message) IsCard() bool { - return m.MsgType == 42 + return m.MsgType == MsgtypeSharecard } func (m *Message) IsVideo() bool { - return m.MsgType == 43 || m.MsgType == 62 + return m.MsgType == MsgtypeVideo || m.MsgType == MsgtypeMicrovideo } func (m *Message) IsMedia() bool { - return m.MsgType == 49 + return m.MsgType == MsgtypeApp } // IsRecalled 判断是否撤回 func (m *Message) IsRecalled() bool { - return m.MsgType == 10002 + return m.MsgType == MsgtypeRecalled } func (m *Message) IsSystem() bool { - return m.MsgType == 10000 + return m.MsgType == MsgtypeSys } func (m *Message) IsNotify() bool {