(route *message.RoutingHead, body *message.MessageBody, random uint32)
| 13 | ) |
| 14 | |
| 15 | func (c *QQClient) SendRawMessage(route *message.RoutingHead, body *message.MessageBody, random uint32) (*action.SendMessageResponse, uint32, error) { |
| 16 | clientSeq := c.getSequence() |
| 17 | msg := &message.Message{ |
| 18 | RoutingHead: route, |
| 19 | ContentHead: &message.ContentHead{ |
| 20 | Type: 1, |
| 21 | SubType: proto.Some(uint32(0)), |
| 22 | DivSeq: proto.Some(uint32(0)), |
| 23 | }, |
| 24 | Body: body, |
| 25 | ClientSequence: proto.Some(clientSeq), |
| 26 | Random: proto.Some(random), |
| 27 | } |
| 28 | // grp_id not null |
| 29 | if (route.Grp != nil && route.Grp.GroupCode.IsSome()) || (route.GrpTmp != nil && route.GrpTmp.GroupUin.IsSome()) { |
| 30 | msg.Ctrl = &message.MessageControl{MsgFlag: int32(utils.TimeStamp())} |
| 31 | } |
| 32 | |
| 33 | data, err := proto.Marshal(msg) |
| 34 | if err != nil { |
| 35 | return nil, 0, err |
| 36 | } |
| 37 | packet, err := c.sendUniPacketAndWait("MessageSvc.PbSendMsg", data) |
| 38 | if err != nil { |
| 39 | return nil, 0, err |
| 40 | } |
| 41 | resp := &action.SendMessageResponse{} |
| 42 | err = proto.Unmarshal(packet, resp) |
| 43 | if err != nil { |
| 44 | return nil, 0, err |
| 45 | } |
| 46 | return resp, clientSeq, err |
| 47 | } |
| 48 | |
| 49 | // SendGroupMessage 发送群聊消息,默认会对消息进行预处理 |
| 50 | func (c *QQClient) SendGroupMessage(groupUin uint32, elements []message2.IMessageElement, needPreprocess ...bool) (*message2.GroupMessage, error) { |
no test coverage detected