Skip to content

Commit

Permalink
feat: 删除好友
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Nov 27, 2024
1 parent 52f6364 commit 0831ba9
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
14 changes: 14 additions & 0 deletions client/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,20 @@ func (c *QQClient) FriendPoke(uin uint32) error {
return oidb2.ParsePokeResp(resp)
}

// DeleteFriend 删除好友
func (c *QQClient) DeleteFriend(uin uint32, block bool) error {
uid := c.GetUID(uin)
pkt, err := oidb2.BuildDeleteFriendReq(uid, block)
if err != nil {
return err
}
resp, err := c.sendOidbPacketAndWait(pkt)
if err != nil {
return err
}
return oidb2.ParseDeleteFriendResp(resp)
}

// RecallFriendMessage 撤回私聊消息
func (c *QQClient) RecallFriendMessage(uin, seq, random, clientSeq, timestamp uint32) error {
packet := message.C2CRecallMsg{
Expand Down
29 changes: 29 additions & 0 deletions client/packets/oidb/delete_friend.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package oidb

import (
"github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb"
)

func BuildDeleteFriendReq(uid string, block bool) (*Packet, error) {
body := oidb.OidbSvcTrpcTcp0X126B_0{
Field1: &oidb.OidbSvcTrpcTcp0X126B_0_Field1{
TargetUid: uid,
Field2: &oidb.OidbSvcTrpcTcp0X126B_0_Field1_2{
Field1: 130,
Field2: 109,
Field3: &oidb.OidbSvcTrpcTcp0X126B_0_Field1_2_3{
Field1: 8,
Field2: 8,
Field3: 50,
},
},
Block: block,
Field4: true,
},
}
return BuildOidbPacket(0x126B, 0, &body, false, false)
}

func ParseDeleteFriendResp(data []byte) error {
return CheckError(data)
}
31 changes: 31 additions & 0 deletions client/packets/pb/service/oidb/OidbSvcTrpcTcp0x126B_0.pb.go

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

26 changes: 26 additions & 0 deletions client/packets/pb/service/oidb/OidbSvcTrpcTcp0x126B_0.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
syntax = "proto3";

option go_package = "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb";

message OidbSvcTrpcTcp0x126B_0 {
OidbSvcTrpcTcp0x126B_0_Field1 Field1 = 1;
}

message OidbSvcTrpcTcp0x126B_0_Field1 {
string TargetUid = 1;
OidbSvcTrpcTcp0x126B_0_Field1_2 Field2 = 2;
bool block = 3;
bool Field4 = 4; // true
}

message OidbSvcTrpcTcp0x126B_0_Field1_2 {
uint32 Field1 = 1; // 130
uint32 Field2 = 2; // 109
OidbSvcTrpcTcp0x126B_0_Field1_2_3 Field3 = 3;
}

message OidbSvcTrpcTcp0x126B_0_Field1_2_3 {
uint32 Field1 = 1; // 8
uint32 Field2 = 2; // 8
uint32 Field3 = 3; // 50
}

0 comments on commit 0831ba9

Please sign in to comment.