Skip to content

Commit 82fea70

Browse files
authored
Feat: 触发按钮回调 (#22)
* feat: setbothd * fix: typo * SGBH add some note * Added set_C2C_bot_hd method * maybe noting * 修正类命名
1 parent c453b4f commit 82fea70

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

lagrange/client/client.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from lagrange.info import AppInfo, DeviceInfo, SigInfo
1717
from lagrange.pb.message.msg_push import MsgPushBody
1818
from lagrange.pb.message.send import SendMsgRsp
19-
from lagrange.pb.service.comm import SendNudge
19+
from lagrange.pb.service.comm import SendGrpBotHD, SendNudge
2020
from lagrange.pb.service.friend import (
2121
GetFriendListRsp,
2222
GetFriendListUin,
@@ -559,3 +559,21 @@ async def get_user_info(
559559
return UserInfo.from_pb(rsp.body[0])
560560
else:
561561
return [UserInfo.from_pb(body) for body in rsp.body]
562+
563+
async def set_grp_bot_hd(
564+
self, grp_id: int, bot_id: int, data_1: str = "", data_2: str = ""
565+
):
566+
await self.send_oidb_svc(
567+
0x112E,
568+
1,
569+
SendGrpBotHD(
570+
grp_id=grp_id, bot_id=bot_id, B_id=data_1, B_data=data_2
571+
).encode(),
572+
)
573+
574+
async def set_c2c_bot_hd(self, bot_id: int, data_1: str = "", data_2: str = ""):
575+
await self.send_oidb_svc(
576+
0x112E,
577+
1,
578+
SendGrpBotHD(bot_id=bot_id, B_id=data_1, B_data=data_2).encode(),
579+
)

lagrange/pb/service/comm.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ class SendNudge(ProtoStruct):
1111
to_grp: Optional[int] = proto_field(2)
1212
to_uin: Optional[int] = proto_field(5)
1313
field6: int = proto_field(6, default=0)
14+
15+
16+
class SendGrpBotHD(ProtoStruct):
17+
bot_id: int = proto_field(3)
18+
seq: int = proto_field(4, default=111111) # nobody care
19+
B_id: str = proto_field(5, default="") # set button_id
20+
B_data: str = proto_field(6, default="") # set button_data
21+
IDD: int = proto_field(7, default=0)
22+
grp_id: int = proto_field(8, default=None)
23+
grp_type: int = proto_field(9, default=0) # 0guild 1grp 2C2C(need grp_id==None)

0 commit comments

Comments
 (0)