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

fix: fix private ptt

This commit is contained in:
wdvxdr 2021-12-19 15:28:59 +08:00
parent 72ffc08b72
commit afb81a32aa
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6

View File

@ -8,6 +8,7 @@ import (
"github.com/pkg/errors"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/internal/highway"
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x346"
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x388"
@ -25,6 +26,22 @@ func init() {
var pttWaiter = utils.NewUploadWaiter()
var c2cPttExtraInfo = binary.NewWriterF(func(w *binary.Writer) {
w.WriteByte(2) // tlv count
w.WriteByte(8)
w.WriteUInt16(4)
w.WriteUInt32(1) // codec
w.WriteByte(9)
w.WriteUInt16(4)
w.WriteUInt32(0) // 时长
w.WriteByte(10)
reserveInfo := []byte{0x08, 0x00, 0x28, 0x00, 0x38, 0x00} // todo
w.WriteBytesShort(reserveInfo)
})
// UploadGroupPtt 将语音数据使用群语音通道上传到服务器, 返回 message.GroupVoiceElement 可直接发送
func (c *QQClient) UploadGroupPtt(groupCode int64, voice io.ReadSeeker) (*message.GroupVoiceElement, error) {
fh, length := utils.ComputeMd5AndLength(voice)
@ -109,7 +126,7 @@ func (c *QQClient) UploadPrivatePtt(target int64, voice io.ReadSeeker) (*message
FileMd5: fh,
FileName: proto.String(hex.EncodeToString(fh) + ".amr"),
FileSize: proto.Int32(int32(length)),
// Reserve: constructPTTExtraInfo(1, int32(len(voice))), // todo length
Reserve: c2cPttExtraInfo,
BoolValid: proto.Bool(true),
},
}, nil