增加实时位置消息并重命名

Signed-off-by: MiiW <mii.w@foxmail.com>
This commit is contained in:
MiiW 2022-11-14 01:15:07 +08:00
parent 3b8019afa2
commit 3fc3e44d78
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 == ""
}
func (m *Message) IsMap() bool {
return m.MsgType == MsgTypeText && m.Url != ""
func (m *Message) IsLocation() bool {
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 {

View File

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