File tree Expand file tree Collapse file tree 3 files changed +33
-5
lines changed
Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,11 @@ class FriendMessage(FriendEvent):
2929class FriendRecall (FriendEvent ):
3030 seq : int
3131 msg_id : int
32- timestamp : int
32+ timestamp : int
33+
34+ @dataclass
35+ class FriendRequest (FriendEvent ):
36+ from_uid : str
37+ to_uid : str
38+ message : str
39+ source : str
Original file line number Diff line number Diff line change 1818 PBGroupInvite ,
1919)
2020from lagrange .pb .status .friend import (
21- PBFriendRecall
21+ PBFriendRecall ,
22+ PBFriendRequest
2223)
2324from lagrange .utils .binary .protobuf import proto_decode , ProtoStruct , proto_encode
2425from lagrange .utils .binary .reader import Reader
4041 GroupMemberJoinedByInvite
4142)
4243from ..events .friend import (
43- FriendRecall
44+ FriendRecall ,
45+ FriendRequest
4446)
4547from ..wtlogin .sso import SSOPacket
4648from .log import logger
@@ -98,7 +100,17 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
98100 inn = pb .info .inner
99101 return GroupMemberJoinRequest (grp_id = inn .grp_id , uid = inn .uid , invitor_uid = inn .invitor_uid )
100102 elif typ == 0x210 : # friend event, 528 / group file upload notice event
101- if sub_typ == 138 : # friend recall
103+ if sub_typ == 35 : # friend request
104+ pb = PBFriendRequest .decode (pkg .message .buf2 )
105+ return FriendRequest (
106+ pkg .response_head .from_uin ,
107+ pb .info .from_uid ,
108+ pkg .response_head .to_uin ,
109+ pb .info .to_uid ,
110+ pb .info .verify ,
111+ pb .info .source
112+ )
113+ elif sub_typ == 138 : # friend recall
102114 pb = PBFriendRecall .decode (pkg .message .buf2 )
103115 return FriendRecall (
104116 pkg .response_head .from_uin ,
Original file line number Diff line number Diff line change @@ -12,4 +12,13 @@ class FriendRecallInfo(ProtoStruct):
1212 div_seq : int = proto_field (9 )
1313
1414class PBFriendRecall (ProtoStruct ):
15- info : FriendRecallInfo = proto_field (1 )
15+ info : FriendRecallInfo = proto_field (1 )
16+
17+ class FriendRequestInfo (ProtoStruct ):
18+ to_uid : str = proto_field (1 )
19+ from_uid : str = proto_field (2 )
20+ verify : str = proto_field (10 ) # 验证消息:我是...
21+ source : str = proto_field (11 )
22+
23+ class PBFriendRequest (ProtoStruct ):
24+ info : FriendRequestInfo = proto_field (1 )
You can’t perform that action at this time.
0 commit comments