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):
29
29
class FriendRecall (FriendEvent ):
30
30
seq : int
31
31
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 18
18
PBGroupInvite ,
19
19
)
20
20
from lagrange .pb .status .friend import (
21
- PBFriendRecall
21
+ PBFriendRecall ,
22
+ PBFriendRequest
22
23
)
23
24
from lagrange .utils .binary .protobuf import proto_decode , ProtoStruct , proto_encode
24
25
from lagrange .utils .binary .reader import Reader
40
41
GroupMemberJoinedByInvite
41
42
)
42
43
from ..events .friend import (
43
- FriendRecall
44
+ FriendRecall ,
45
+ FriendRequest
44
46
)
45
47
from ..wtlogin .sso import SSOPacket
46
48
from .log import logger
@@ -98,7 +100,17 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
98
100
inn = pb .info .inner
99
101
return GroupMemberJoinRequest (grp_id = inn .grp_id , uid = inn .uid , invitor_uid = inn .invitor_uid )
100
102
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
102
114
pb = PBFriendRecall .decode (pkg .message .buf2 )
103
115
return FriendRecall (
104
116
pkg .response_head .from_uin ,
Original file line number Diff line number Diff line change @@ -12,4 +12,13 @@ class FriendRecallInfo(ProtoStruct):
12
12
div_seq : int = proto_field (9 )
13
13
14
14
class 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