Skip to content

Feat: 触发按钮回调 #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 17, 2024
20 changes: 19 additions & 1 deletion lagrange/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.friend import (
GetFriendListRsp,
GetFriendListUin,
Expand Down Expand Up @@ -559,3 +559,21 @@ 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_1: str = "", data_2: str = ""
):
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_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(),
)
10 changes: 10 additions & 0 deletions lagrange/pb/service/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) # 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)
grp_id: int = proto_field(8, default=None)
grp_type: int = proto_field(9, default=0) # 0guild 1grp 2C2C(need grp_id==None)