From d740596fac16801ded3395455c564b72c1a45b0a Mon Sep 17 00:00:00 2001 From: icarus-ai <82353054+icarus-ai@users.noreply.github.com> Date: Mon, 14 Oct 2024 09:41:35 +0800 Subject: [PATCH] =?UTF-8?q?add:=20SendFriendLike=20=E5=8F=91=E9=80=81?= =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E8=B5=9E=20(#103)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/operation.go | 23 +++++++++++++++---- client/packets/oidb/friend_like.go | 4 ++-- .../oidb/OidbSvcTrpcTcp0x7E5_104.pb.go | 6 ++--- .../oidb/OidbSvcTrpcTcp0x7E5_104.proto | 4 ++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/client/operation.go b/client/operation.go index 5647ee31..4fbd5e80 100644 --- a/client/operation.go +++ b/client/operation.go @@ -16,22 +16,21 @@ import ( "strings" "time" - "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/highway" - - "github.com/LagrangeDev/LagrangeGo/client/packets/pb/action" + "github.com/tidwall/gjson" "golang.org/x/net/html" "github.com/LagrangeDev/LagrangeGo/client/entity" messagePkt "github.com/LagrangeDev/LagrangeGo/client/packets/message" - oidb2 "github.com/LagrangeDev/LagrangeGo/client/packets/oidb" + oidb2 "github.com/LagrangeDev/LagrangeGo/client/packets/oidb" + "github.com/LagrangeDev/LagrangeGo/client/packets/pb/action" "github.com/LagrangeDev/LagrangeGo/client/packets/pb/message" + "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/highway" "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service/oidb" "github.com/LagrangeDev/LagrangeGo/internal/proto" message2 "github.com/LagrangeDev/LagrangeGo/message" "github.com/LagrangeDev/LagrangeGo/utils/binary" "github.com/LagrangeDev/LagrangeGo/utils/crypto" - "github.com/tidwall/gjson" ) func (c *QQClient) SetOnlineStatus(status, ext, battery uint32) error { @@ -1217,3 +1216,17 @@ func (c *QQClient) SetEssenceMessage(groupUin, seq, random uint32, isSet bool) e } return oidb2.ParseSetEssenceMessageResp(resp) } + +// SendFriendLike 发送好友赞 +func (c *QQClient) SendFriendLike(uin uint32, count uint32) error { + if count > 20 { count = 20 } else if count < 1 { count = 1 } + pkt, err := oidb2.BuildFriendLikeReq(c.GetUid(uin), count) + if err != nil { + return err + } + resp, err := c.sendOidbPacketAndWait(pkt) + if err != nil { + return err + } + return oidb2.ParseFriendLikeResp(resp) +} diff --git a/client/packets/oidb/friend_like.go b/client/packets/oidb/friend_like.go index 54a3836d..99394a72 100644 --- a/client/packets/oidb/friend_like.go +++ b/client/packets/oidb/friend_like.go @@ -8,8 +8,8 @@ import ( func BuildFriendLikeReq(uid string, count uint32) (*OidbPacket, error) { body := &oidb.OidbSvcTrpcTcp0X7E5_104{ TargetUid: proto.Some(uid), - Field2: 71, - Field3: count, + Source : 71, + Count : count, } return BuildOidbPacket(0x7E5, 104, body, false, false) } diff --git a/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x7E5_104.pb.go b/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x7E5_104.pb.go index 51e99fe9..afcec7b6 100644 --- a/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x7E5_104.pb.go +++ b/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x7E5_104.pb.go @@ -10,7 +10,7 @@ import ( // Friend Likes type OidbSvcTrpcTcp0X7E5_104 struct { TargetUid proto.Option[string] `protobuf:"bytes,11,opt"` - Field2 uint32 `protobuf:"varint,12,opt"` // 71 - Field3 uint32 `protobuf:"varint,13,opt"` // 1 + Source uint32 `protobuf:"varint,12,opt"` // 71 + Count uint32 `protobuf:"varint,13,opt"` // 1 _ [0]func() -} +} \ No newline at end of file diff --git a/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x7E5_104.proto b/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x7E5_104.proto index 7669a854..d628f50d 100644 --- a/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x7E5_104.proto +++ b/client/packets/pb/service/oidb/OidbSvcTrpcTcp0x7E5_104.proto @@ -5,6 +5,6 @@ option go_package = "github.com/LagrangeDev/LagrangeGo/client/packets/pb/service // Friend Likes message OidbSvcTrpcTcp0x7E5_104 { optional string TargetUid = 11; - uint32 Field2 = 12; // 71 - uint32 Field3 = 13; // 1 + uint32 Source = 12; // 71 + uint32 Count = 13; // 1 }