mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
fix: fix private ptt
This commit is contained in:
parent
72ffc08b72
commit
afb81a32aa
@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
"github.com/Mrs4s/MiraiGo/client/internal/highway"
|
"github.com/Mrs4s/MiraiGo/client/internal/highway"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x346"
|
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x346"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x388"
|
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x388"
|
||||||
@ -25,6 +26,22 @@ func init() {
|
|||||||
|
|
||||||
var pttWaiter = utils.NewUploadWaiter()
|
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 可直接发送
|
// UploadGroupPtt 将语音数据使用群语音通道上传到服务器, 返回 message.GroupVoiceElement 可直接发送
|
||||||
func (c *QQClient) UploadGroupPtt(groupCode int64, voice io.ReadSeeker) (*message.GroupVoiceElement, error) {
|
func (c *QQClient) UploadGroupPtt(groupCode int64, voice io.ReadSeeker) (*message.GroupVoiceElement, error) {
|
||||||
fh, length := utils.ComputeMd5AndLength(voice)
|
fh, length := utils.ComputeMd5AndLength(voice)
|
||||||
@ -109,7 +126,7 @@ func (c *QQClient) UploadPrivatePtt(target int64, voice io.ReadSeeker) (*message
|
|||||||
FileMd5: fh,
|
FileMd5: fh,
|
||||||
FileName: proto.String(hex.EncodeToString(fh) + ".amr"),
|
FileName: proto.String(hex.EncodeToString(fh) + ".amr"),
|
||||||
FileSize: proto.Int32(int32(length)),
|
FileSize: proto.Int32(int32(length)),
|
||||||
// Reserve: constructPTTExtraInfo(1, int32(len(voice))), // todo length
|
Reserve: c2cPttExtraInfo,
|
||||||
BoolValid: proto.Bool(true),
|
BoolValid: proto.Bool(true),
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user