mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-07-08 07:08:32 +00:00
Compare commits
3 Commits
master
...
9ee41fc5f9
Author | SHA1 | Date | |
---|---|---|---|
9ee41fc5f9 | |||
cd753c1953 | |||
f4a63a83cd |
@ -195,16 +195,16 @@ func (c *QQClient) parsePrivateMessage(msg *msg.Message) *message.PrivateMessage
|
||||
Sender: sender,
|
||||
Self: c.Uin,
|
||||
Elements: func() []message.IMessageElement {
|
||||
if msg.Body.RichText.Ptt != nil {
|
||||
return []message.IMessageElement{
|
||||
&message.VoiceElement{
|
||||
Name: msg.Body.RichText.Ptt.FileName.Unwrap(),
|
||||
Md5: msg.Body.RichText.Ptt.FileMd5,
|
||||
Size: msg.Body.RichText.Ptt.FileSize.Unwrap(),
|
||||
Url: string(msg.Body.RichText.Ptt.DownPara),
|
||||
},
|
||||
}
|
||||
}
|
||||
// if msg.Body.RichText.Ptt != nil {
|
||||
// return []message.IMessageElement{
|
||||
// &message.VoiceElement{
|
||||
// Name: msg.Body.RichText.Ptt.FileName.Unwrap(),
|
||||
// Md5: msg.Body.RichText.Ptt.FileMd5,
|
||||
// Size: msg.Body.RichText.Ptt.FileSize.Unwrap(),
|
||||
// Url: string(msg.Body.RichText.Ptt.DownPara),
|
||||
// },
|
||||
// }
|
||||
// }
|
||||
return message.ParseMessageElems(msg.Body.RichText.Elems)
|
||||
}(),
|
||||
}
|
||||
|
@ -898,7 +898,9 @@ type PbMultiMediaElement struct {
|
||||
Meta *struct {
|
||||
Data *struct {
|
||||
FileLen proto.Option[int32] `protobuf:"varint,1,opt"`
|
||||
PicMd5 []byte `protobuf:"bytes,2,opt"`
|
||||
FileMd5 []byte `protobuf:"bytes,2,opt"`
|
||||
FileSha1 proto.Option[string] `protobuf:"bytes,3,opt"`
|
||||
FileName proto.Option[string] `protobuf:"bytes,4,opt"`
|
||||
} `protobuf:"bytes,1,opt"`
|
||||
FilePath proto.Option[string] `protobuf:"bytes,2,opt"`
|
||||
} `protobuf:"bytes,1,opt"`
|
||||
|
@ -671,12 +671,13 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
|
||||
Name: strings.TrimPrefix(string(animatedStickerMsg.Text), "/"),
|
||||
}
|
||||
return []IMessageElement{sticker} // sticker 永远为单独消息
|
||||
case 48:
|
||||
}
|
||||
switch elem.CommonElem.BusinessType.Unwrap() {
|
||||
case 10, 20:
|
||||
img := &msg.PbMultiMediaElement{}
|
||||
_ = proto.Unmarshal(elem.CommonElem.PbElem, img)
|
||||
domain := img.Elem1.Data.Domain.Unwrap()
|
||||
imgURL := img.Elem1.Data.ImgURL.Unwrap()
|
||||
|
||||
if img.Elem2.Data.Friend != nil {
|
||||
rKey := img.Elem2.Data.Friend.RKey.Unwrap()
|
||||
url := fmt.Sprintf("https://%s%s%s&spec=0&rf=naio", domain, imgURL, rKey)
|
||||
@ -684,7 +685,7 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
|
||||
ImageId: img.Elem1.Meta.FilePath.Unwrap(),
|
||||
Size: img.Elem1.Meta.Data.FileLen.Unwrap(),
|
||||
Url: url,
|
||||
Md5: img.Elem1.Meta.Data.PicMd5,
|
||||
Md5: img.Elem1.Meta.Data.FileMd5,
|
||||
})
|
||||
newImg = true
|
||||
}
|
||||
@ -695,12 +696,20 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
|
||||
ImageId: img.Elem1.Meta.FilePath.Unwrap(),
|
||||
Size: img.Elem1.Meta.Data.FileLen.Unwrap(),
|
||||
Url: url,
|
||||
Md5: img.Elem1.Meta.Data.PicMd5,
|
||||
Md5: img.Elem1.Meta.Data.FileMd5,
|
||||
})
|
||||
newImg = true
|
||||
}
|
||||
case 12, 22:
|
||||
audio := &msg.PbMultiMediaElement{}
|
||||
_ = proto.Unmarshal(elem.CommonElem.PbElem, audio)
|
||||
res = append(res, &VoiceElement{
|
||||
Name: audio.Elem1.Meta.Data.FileName.Unwrap(),
|
||||
Md5: audio.Elem1.Meta.Data.FileMd5,
|
||||
Size: audio.Elem1.Meta.Data.FileLen.Unwrap(),
|
||||
Url: audio.Elem1.Meta.FilePath.Unwrap(), // url is wrong TODO:get url with rkey
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return res
|
||||
|
Reference in New Issue
Block a user