MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / BuildMultiMsgUploadReq

Function BuildMultiMsgUploadReq

client/packets/message/multi_msg_upload.go:12–40  ·  view source on GitHub ↗
(selfUID string, groupUin uint32, msg []*message.PushMsgBody)

Source from the content-addressed store, hash-verified

10)
11
12func BuildMultiMsgUploadReq(selfUID string, groupUin uint32, msg []*message.PushMsgBody) ([]byte, error) {
13 longMsgResult := &message.LongMsgResult{
14 Action: []*message.LongMsgAction{{
15 ActionCommand: "MultiMsg",
16 ActionData: &message.LongMsgContent{
17 MsgBody: msg,
18 },
19 }},
20 }
21 longMsgResultData, _ := proto.Marshal(longMsgResult)
22 payload := binary.GZipCompress(longMsgResultData)
23 req := &message.SendLongMsgReq{
24 Info: &message.SendLongMsgInfo{
25 Type: utils.Ternary[uint32](groupUin == 0, 1, 3),
26 Uid: &message.LongMsgUid{
27 Uid: proto.String(utils.Ternary(groupUin == 0, selfUID, strconv.Itoa(int(groupUin)))),
28 },
29 GroupUin: proto.Uint32(groupUin),
30 Payload: payload,
31 },
32 Settings: &message.LongMsgSettings{
33 Field1: 4,
34 Field2: 1,
35 Field3: 7,
36 Field4: 0,
37 },
38 }
39 return proto.Marshal(req)
40}
41
42func ParseMultiMsgUploadResp(data []byte) (resp *message.SendLongMsgResp, err error) {
43 resp = &message.SendLongMsgResp{}

Callers

nothing calls this directly

Calls 5

MarshalFunction · 0.92
GZipCompressFunction · 0.92
StringFunction · 0.92
TernaryFunction · 0.92
Uint32Function · 0.92

Tested by

no test coverage detected