mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 19:17:38 +08:00
fix recall error.
This commit is contained in:
parent
37bfcb6971
commit
b5cce86b4d
@ -144,6 +144,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
|
|||||||
"MessageSvc.PbGetMsg": decodeMessageSvcPacket,
|
"MessageSvc.PbGetMsg": decodeMessageSvcPacket,
|
||||||
"MessageSvc.PbSendMsg": decodeMsgSendResponse,
|
"MessageSvc.PbSendMsg": decodeMsgSendResponse,
|
||||||
"MessageSvc.PushForceOffline": decodeForceOfflinePacket,
|
"MessageSvc.PushForceOffline": decodeForceOfflinePacket,
|
||||||
|
"PbMessageSvc.PbMsgWithDraw": decodeMsgWithDrawResponse,
|
||||||
"friendlist.getFriendGroupList": decodeFriendGroupListResponse,
|
"friendlist.getFriendGroupList": decodeFriendGroupListResponse,
|
||||||
"friendlist.GetTroopListReqV2": decodeGroupListResponse,
|
"friendlist.GetTroopListReqV2": decodeGroupListResponse,
|
||||||
"friendlist.GetTroopMemberListReq": decodeGroupMemberListResponse,
|
"friendlist.GetTroopMemberListReq": decodeGroupMemberListResponse,
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
"github.com/Mrs4s/MiraiGo/client/pb/msg"
|
"github.com/Mrs4s/MiraiGo/client/pb/msg"
|
||||||
"github.com/Mrs4s/MiraiGo/protocol/packets"
|
"github.com/Mrs4s/MiraiGo/protocol/packets"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
@ -8,14 +10,14 @@ import (
|
|||||||
|
|
||||||
// 撤回相关处理逻辑
|
// 撤回相关处理逻辑
|
||||||
|
|
||||||
func (c *QQClient) RecallGroupMessage(groupCode int64, msgId, msgInternalId int32) {
|
func (c *QQClient) RecallGroupMessage(groupCode int64, msgId, msgInternalId int32) error {
|
||||||
_, pkt := c.buildGroupRecallPacket(groupCode, msgId, msgInternalId)
|
_, err := c.sendAndWait(c.buildGroupRecallPacket(groupCode, msgId, msgInternalId))
|
||||||
_ = c.send(pkt)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) RecallPrivateMessage(uin, ts int64, msgId, msgInternalId int32) {
|
func (c *QQClient) RecallPrivateMessage(uin, ts int64, msgId, msgInternalId int32) error {
|
||||||
_, pkt := c.buildPrivateRecallPacket(uin, ts, msgId, msgInternalId)
|
_, err := c.sendAndWait(c.buildPrivateRecallPacket(uin, ts, msgId, msgInternalId))
|
||||||
_ = c.send(pkt)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// PbMessageSvc.PbMsgWithDraw
|
// PbMessageSvc.PbMsgWithDraw
|
||||||
@ -64,3 +66,21 @@ func (c *QQClient) buildPrivateRecallPacket(uin, ts int64, msgSeq, random int32)
|
|||||||
packet := packets.BuildUniPacket(c.Uin, seq, "PbMessageSvc.PbMsgWithDraw", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
packet := packets.BuildUniPacket(c.Uin, seq, "PbMessageSvc.PbMsgWithDraw", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
|
||||||
return seq, packet
|
return seq, packet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func decodeMsgWithDrawResponse(_ *QQClient, _ uint16, payload []byte) (interface{}, error) {
|
||||||
|
rsp := msg.MsgWithDrawResp{}
|
||||||
|
if err := proto.Unmarshal(payload, &rsp); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(rsp.C2CWithDraw) > 0 {
|
||||||
|
if rsp.C2CWithDraw[0].GetResult() != 0 {
|
||||||
|
return nil, errors.New(fmt.Sprintf("recall error: %v msg: %v", rsp.C2CWithDraw[0].GetResult(), rsp.C2CWithDraw[0].GetErrMsg()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(rsp.GroupWithDraw) > 0 {
|
||||||
|
if rsp.GroupWithDraw[0].GetResult() != 0 {
|
||||||
|
return nil, errors.New(fmt.Sprintf("recall error: %v msg: %v", rsp.C2CWithDraw[0].GetResult(), rsp.C2CWithDraw[0].GetErrMsg()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user