Skip to content

Commit

Permalink
feat: 私聊消息撤回
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Sep 9, 2024
1 parent 7ebbf04 commit 2a9e85f
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
29 changes: 29 additions & 0 deletions client/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,35 @@ func (c *QQClient) FriendPoke(uin uint32) error {
return oidb2.ParsePokeResp(resp)
}

func (c *QQClient) RecallFriendMessage(uin, seq, random, clientSeq, timestamp uint32) error {
packet := message.C2CRecallMsg{
Type: 1,
TargetUid: c.GetUid(uin),
Info: &message.C2CRecallMsgInfo{
ClientSequence: clientSeq,
Random: random,
MessageId: 0x10000000<<32 | uint64(random),
Timestamp: timestamp,
Field5: 0,
MessageSequence: seq,
},
Settings: &message.C2CRecallMsgSettings{
Field1: false,
Field2: false,
},
Field6: false,
}
pkt, err := proto.Marshal(&packet)
if err != nil {
return err
}
_, err = c.sendUniPacketAndWait("trpc.msg.msg_svc.MsgService.SsoC2CRecallMsg", pkt)
if err != nil {
return err
}
return nil // sbtx不报错
}

// RecallGroupMessage 撤回群聊消息
func (c *QQClient) RecallGroupMessage(GrpUin, seq uint32) error {
packet := message.GroupRecallMsg{
Expand Down
25 changes: 25 additions & 0 deletions client/packets/pb/message/c2c.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions client/packets/pb/message/c2c.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,25 @@ message C2C {
optional uint32 ReceiverUin = 5;
optional string ReceiverUid = 6;
}

message C2CRecallMsg {
uint32 Type = 1;
string TargetUid = 3;
C2CRecallMsgInfo Info = 4;
C2CRecallMsgSettings Settings = 5;
bool Field6 = 6;
}

message C2CRecallMsgInfo {
uint32 ClientSequence = 1;
uint32 Random = 2;
uint64 MessageId = 3;
uint32 Timestamp = 4;
uint32 Field5 = 5;
uint32 MessageSequence = 6;
}

message C2CRecallMsgSettings {
bool Field1 = 1;
bool Field2 = 2;
}

0 comments on commit 2a9e85f

Please sign in to comment.