1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

update voice.

This commit is contained in:
Mrs4s 2020-08-08 12:46:35 +08:00
parent 2a32e62327
commit cd20d7d43d
3 changed files with 28 additions and 1 deletions

View File

@ -386,7 +386,10 @@ func (c *QQClient) buildDeleteOnlinePushPacket(uin int64, seq uint16, delMsg []j
func (c *QQClient) buildGroupSendingPacket(groupCode int64, r int32, forward bool, m *message.SendingMessage) (uint16, []byte) {
seq := c.nextSeq()
var ptt *message.GroupVoiceElement
if i := m.FirstOrNil(func(e message.IMessageElement) bool { return e.Type() == message.Voice }); i != nil {
if i := m.FirstOrNil(func(e message.IMessageElement) bool {
_, ok := e.(*message.GroupVoiceElement)
return ok
}); i != nil {
ptt = i.(*message.GroupVoiceElement)
m.Elements = []message.IMessageElement{}
}

View File

@ -269,6 +269,16 @@ func (c *QQClient) parseGroupMessage(m *msg.Message) *message.GroupMessage {
Elements: message.ParseMessageElems(m.Body.RichText.Elems),
//OriginalElements: m.Body.RichText.Elems,
}
if m.Body.RichText.Ptt != nil {
g.Elements = []message.IMessageElement{
&message.VoiceElement{
Name: m.Body.RichText.Ptt.FileName,
Md5: m.Body.RichText.Ptt.FileMd5,
Size: m.Body.RichText.Ptt.FileSize,
DownloadPara: string(m.Body.RichText.Ptt.DownPara),
},
}
}
if m.Body.RichText.Attr != nil {
g.InternalId = m.Body.RichText.Attr.Random
}

View File

@ -25,6 +25,16 @@ type GroupImageElement struct {
Url string
}
type VoiceElement struct {
Name string
Md5 []byte
Size int32
DownloadPara string
// --- sending ---
Data []byte
}
type GroupVoiceElement struct {
Data []byte
Ptt *msg.Ptt
@ -186,6 +196,10 @@ func (e *GroupVoiceElement) Type() ElementType {
return Voice
}
func (e *VoiceElement) Type() ElementType {
return Voice
}
var faceMap = map[int]string{
14: "微笑",
1: "撇嘴",