Merge pull request #126 from MiiW/dev

增加实时位置消息并重命名
This commit is contained in:
多吃点苹果 2022-11-14 10:37:02 +08:00 committed by GitHub
commit f32f905b55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -185,8 +185,20 @@ func (m *Message) IsText() bool {
return m.MsgType == MsgTypeText && m.Url == "" return m.MsgType == MsgTypeText && m.Url == ""
} }
func (m *Message) IsMap() bool { func (m *Message) IsLocation() bool {
return m.MsgType == MsgTypeText && m.Url != "" return m.MsgType == MsgTypeText && strings.Contains(m.Url, "api.map.qq.com") && strings.Contains(m.Content, "pictype=location")
}
func (m *Message) IsRealtimeLocation() bool {
return m.IsRealtimeLocationStart() || m.IsRealtimeLocationStop()
}
func (m *Message) IsRealtimeLocationStart() bool {
return m.MsgType == MsgTypeApp && m.AppMsgType == AppMsgTypeRealtimeShareLocation
}
func (m *Message) IsRealtimeLocationStop() bool {
return m.MsgType == MsgTypeSys && m.Content == "位置共享已经结束"
} }
func (m *Message) IsPicture() bool { func (m *Message) IsPicture() bool {

View File

@ -51,7 +51,7 @@ msg.IsPicture()
##### 位置消息 ##### 位置消息
```go ```go
msg.IsMap() msg.IsLocation()
``` ```
##### 语音消息 ##### 语音消息