Skip to content

Commit c47fe4f

Browse files
committed
fix&comment
1 parent 6c6405c commit c47fe4f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

wechaty-puppet/schemas/message.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,10 @@ type MessagePayloadBase struct {
9797
ReferMessage *ReferMessagePayload
9898
}
9999

100+
// ReferMessagePayload refer message payload
100101
type ReferMessagePayload struct {
101102
Type MessageType // TODO: 确认是否和 MessageType 一致
102-
SourceMsgId string
103+
SourceMsgID string
103104
TalkerId string
104105
RoomId string
105106
DisplayName string

wechaty/user/message.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,14 @@ func (m *Message) Date() time.Time {
147147
return m.payload.Timestamp
148148
}
149149

150+
// ReferMessage get the refer message
150151
func (m *Message) ReferMessage() *schemas.ReferMessagePayload {
151-
return &(*m.payload.ReferMessage) // 不希望能被修改原数据
152+
if m.payload.ReferMessage == nil {
153+
return nil
154+
}
155+
156+
copy := *m.payload.ReferMessage
157+
return &copy
152158
}
153159

154160
// Say reply a Text or Media File message to the sender.

0 commit comments

Comments
 (0)