Skip to content

Commit 6c6405c

Browse files
committed
feat(message): support refer msg
1 parent 0d6c5b3 commit 6c6405c

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

wechaty-puppet/puppet.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package wechatypuppet
33
import (
44
"errors"
55
"fmt"
6+
67
lru "github.com/hashicorp/golang-lru"
8+
79
"github.com/wechaty/go-wechaty/wechaty-puppet/events"
810
"github.com/wechaty/go-wechaty/wechaty-puppet/filebox"
911
"github.com/wechaty/go-wechaty/wechaty-puppet/helper"

wechaty-puppet/schemas/message.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ type MessagePayloadBase struct {
9393

9494
// 小程序有些消息类型,wechaty服务端解析不处理,框架端解析。 xml type 36 是小程序
9595
FixMiniApp bool
96+
97+
ReferMessage *ReferMessagePayload
98+
}
99+
100+
type ReferMessagePayload struct {
101+
Type MessageType // TODO: 确认是否和 MessageType 一致
102+
SourceMsgId string
103+
TalkerId string
104+
RoomId string
105+
DisplayName string
106+
Content string
107+
Timestamp time.Time
96108
}
97109

98110
type MessagePayloadRoom struct {

wechaty/user/message.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ func (m *Message) Date() time.Time {
147147
return m.payload.Timestamp
148148
}
149149

150+
func (m *Message) ReferMessage() *schemas.ReferMessagePayload {
151+
return &(*m.payload.ReferMessage) // 不希望能被修改原数据
152+
}
153+
150154
// Say reply a Text or Media File message to the sender.
151155
// Support msg:
152156
// string

0 commit comments

Comments
 (0)