From ea8da991d2b7e573f8f5c2563e0833399c3cd62c Mon Sep 17 00:00:00 2001 From: Decrabbit Date: Thu, 15 Aug 2024 01:20:07 +0800 Subject: [PATCH 1/6] feat: setbothd --- lagrange/client/client.py | 18 +++++++++++++++++- lagrange/pb/service/comm.py | 10 ++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lagrange/client/client.py b/lagrange/client/client.py index 3b94454..283cb1b 100644 --- a/lagrange/client/client.py +++ b/lagrange/client/client.py @@ -16,7 +16,7 @@ from lagrange.info import AppInfo, DeviceInfo, SigInfo from lagrange.pb.message.msg_push import MsgPushBody from lagrange.pb.message.send import SendMsgRsp -from lagrange.pb.service.comm import SendNudge +from lagrange.pb.service.comm import SendGrpBotHD, SendNudge from lagrange.pb.service.group import ( FetchGroupResponse, GetGrpMsgRsp, @@ -497,3 +497,19 @@ async def get_user_info( return UserInfo.from_pb(rsp.body[0]) else: return [UserInfo.from_pb(body) for body in rsp.body] + + async def set_grp_bot_hd( + self, grp_id: int, bot_id: int, data: Optional[str] = None + ): + if data: + await self.send_oidb_svc( + 0x112E, + 1, + SendGrpBotHD(grp_id=grp_id, bot_id=bot_id, B_data=data).encode(), + ) + else: + await self.send_oidb_svc( + 0x112E, + 1, + SendGrpBotHD(grp_id=grp_id, bot_id=bot_id).encode(), + ) diff --git a/lagrange/pb/service/comm.py b/lagrange/pb/service/comm.py index 7dda6d3..2b0aa6b 100644 --- a/lagrange/pb/service/comm.py +++ b/lagrange/pb/service/comm.py @@ -11,3 +11,13 @@ class SendNudge(ProtoStruct): to_grp: Optional[int] = proto_field(2) to_uin: Optional[int] = proto_field(5) field6: int = proto_field(6, default=0) + + +class SendGrpBotHD(ProtoStruct): + bot_id: int = proto_field(3) + seq: int = proto_field(4, default=111111) # no body care + B_id: str = proto_field(5, default="") # set button_id + B_data: str = proto_field(6, default="") # set button_data + IDD: int = proto_field(7, default=0) + grp_id: int = proto_field(8) + grp_type: int = proto_field(9, default=0) # 0guild 1grp 2tx inner grp(maybe) From e09564296340744b406331b89de1a22f5dd9b185 Mon Sep 17 00:00:00 2001 From: Decrabbityyy <99632363+Decrabbityyy@users.noreply.github.com> Date: Thu, 15 Aug 2024 03:56:18 +0800 Subject: [PATCH 2/6] fix: typo --- lagrange/pb/service/comm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lagrange/pb/service/comm.py b/lagrange/pb/service/comm.py index 2b0aa6b..a73f550 100644 --- a/lagrange/pb/service/comm.py +++ b/lagrange/pb/service/comm.py @@ -15,7 +15,7 @@ class SendNudge(ProtoStruct): class SendGrpBotHD(ProtoStruct): bot_id: int = proto_field(3) - seq: int = proto_field(4, default=111111) # no body care + seq: int = proto_field(4, default=111111) # nobody care B_id: str = proto_field(5, default="") # set button_id B_data: str = proto_field(6, default="") # set button_data IDD: int = proto_field(7, default=0) From 5c3d39fadc751f146fc12e488d486f487b68cc53 Mon Sep 17 00:00:00 2001 From: Decrabbit Date: Thu, 15 Aug 2024 11:15:07 +0800 Subject: [PATCH 3/6] SGBH add some note --- lagrange/pb/service/comm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lagrange/pb/service/comm.py b/lagrange/pb/service/comm.py index 2b0aa6b..365fc1e 100644 --- a/lagrange/pb/service/comm.py +++ b/lagrange/pb/service/comm.py @@ -19,5 +19,5 @@ class SendGrpBotHD(ProtoStruct): B_id: str = proto_field(5, default="") # set button_id B_data: str = proto_field(6, default="") # set button_data IDD: int = proto_field(7, default=0) - grp_id: int = proto_field(8) - grp_type: int = proto_field(9, default=0) # 0guild 1grp 2tx inner grp(maybe) + grp_id: int = proto_field(8, default=None) + grp_type: int = proto_field(9, default=0) # 0guild 1grp 2C2C(need grp_id==None) From 5036eccf9d5c5e26c37c512acd677fa6f5572931 Mon Sep 17 00:00:00 2001 From: Decrabbit Date: Thu, 15 Aug 2024 11:20:54 +0800 Subject: [PATCH 4/6] Added set_C2C_bot_hd method --- lagrange/client/client.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lagrange/client/client.py b/lagrange/client/client.py index 283cb1b..8495415 100644 --- a/lagrange/client/client.py +++ b/lagrange/client/client.py @@ -513,3 +513,17 @@ async def set_grp_bot_hd( 1, SendGrpBotHD(grp_id=grp_id, bot_id=bot_id).encode(), ) + + async def set_C2C_bot_hd(self, bot_id: int, data: Optional[str] = None): + if data: + await self.send_oidb_svc( + 0x112E, + 1, + SendGrpBotHD(bot_id=bot_id, B_data=data).encode(), + ) + else: + await self.send_oidb_svc( + 0x112E, + 1, + SendGrpBotHD(bot_id=bot_id).encode(), + ) From 0847eebc5fc01d36c93f7fa63669c4c38a33b778 Mon Sep 17 00:00:00 2001 From: Decrabbit Date: Thu, 15 Aug 2024 16:28:46 +0800 Subject: [PATCH 5/6] maybe noting --- lagrange/client/client.py | 40 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/lagrange/client/client.py b/lagrange/client/client.py index 8495415..e19ca22 100644 --- a/lagrange/client/client.py +++ b/lagrange/client/client.py @@ -499,31 +499,19 @@ async def get_user_info( return [UserInfo.from_pb(body) for body in rsp.body] async def set_grp_bot_hd( - self, grp_id: int, bot_id: int, data: Optional[str] = None + self, grp_id: int, bot_id: int, data_1: str = "", data_2: str = "" ): - if data: - await self.send_oidb_svc( - 0x112E, - 1, - SendGrpBotHD(grp_id=grp_id, bot_id=bot_id, B_data=data).encode(), - ) - else: - await self.send_oidb_svc( - 0x112E, - 1, - SendGrpBotHD(grp_id=grp_id, bot_id=bot_id).encode(), - ) + await self.send_oidb_svc( + 0x112E, + 1, + SendGrpBotHD( + grp_id=grp_id, bot_id=bot_id, B_id=data_1, B_data=data_2 + ).encode(), + ) - async def set_C2C_bot_hd(self, bot_id: int, data: Optional[str] = None): - if data: - await self.send_oidb_svc( - 0x112E, - 1, - SendGrpBotHD(bot_id=bot_id, B_data=data).encode(), - ) - else: - await self.send_oidb_svc( - 0x112E, - 1, - SendGrpBotHD(bot_id=bot_id).encode(), - ) + async def set_C2C_bot_hd(self, bot_id: int, data_1: str = "", data_2: str = ""): + await self.send_oidb_svc( + 0x112E, + 1, + SendGrpBotHD(bot_id=bot_id, B_id=data_1, B_data=data_2).encode(), + ) From 3d2afd078d2887184d0e1ac8b1e295f07859cc67 Mon Sep 17 00:00:00 2001 From: Decrabbit Date: Thu, 15 Aug 2024 23:56:05 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=B1=BB=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lagrange/client/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lagrange/client/client.py b/lagrange/client/client.py index b21d258..81daac1 100644 --- a/lagrange/client/client.py +++ b/lagrange/client/client.py @@ -569,7 +569,7 @@ async def set_grp_bot_hd( ).encode(), ) - async def set_C2C_bot_hd(self, bot_id: int, data_1: str = "", data_2: str = ""): + async def set_c2c_bot_hd(self, bot_id: int, data_1: str = "", data_2: str = ""): await self.send_oidb_svc( 0x112E, 1,