1414 MemberJoinRequest ,
1515 MemberRecallMsg ,
1616 GroupSub20Head ,
17+ PBBotGrayTip ,
1718 PBGroupAlbumUpdate ,
19+ PBGroupBotAdded ,
1820 PBGroupInvite ,
21+ PBSelfJoinInGroup ,
1922)
20- from lagrange .pb .status .friend import (
21- PBFriendRecall ,
22- PBFriendRequest
23- )
23+ from lagrange .pb .status .friend import PBFriendRecall , PBFriendRequest
2424from lagrange .utils .binary .protobuf import proto_decode , ProtoStruct , proto_encode
2525from lagrange .utils .binary .reader import Reader
2626from lagrange .utils .operator import unpack_dict , timestamp
2727
2828from ..events .group import (
29+ BotGrayTip ,
30+ GroupBotAdded ,
31+ GroupBotJoined ,
2932 GroupInvite ,
3033 GroupMemberGotSpecialTitle ,
3134 GroupMemberJoined ,
3639 GroupRecall ,
3740 GroupNudge ,
3841 GroupReaction ,
42+ GroupSelfJoined ,
43+ GroupSelfRequireReject ,
3944 GroupSign ,
4045 GroupAlbumUpdate ,
41- GroupMemberJoinedByInvite
42- )
43- from ..events .friend import (
44- FriendRecall ,
45- FriendRequest
46+ GroupMemberJoinedByInvite ,
4647)
48+ from ..events .friend import FriendRecall , FriendRequest
4749from ..wtlogin .sso import SSOPacket
4850from .log import logger
4951
@@ -74,10 +76,9 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
7476 elif typ == 33 : # member joined
7577 pb = MemberChanged .decode (pkg .message .buf2 )
7678 return GroupMemberJoined (
77- grp_id = pkg .response_head .from_uin ,
78- uin = pb .uin ,
79- uid = pb .uid ,
80- join_type = pb .join_type ,
79+ grp_id = pb .uin ,
80+ uid = pb .uid , # right u cant get uin
81+ join_type = pb .join_type_new ,
8182 )
8283 elif typ == 34 : # member exit
8384 pb = MemberChanged .decode (pkg .message .buf2 )
@@ -91,26 +92,35 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
9192 elif typ == 84 :
9293 pb = MemberJoinRequest .decode (pkg .message .buf2 )
9394 return GroupMemberJoinRequest (grp_id = pb .grp_id , uid = pb .uid , answer = pb .request_field )
95+ elif typ == 85 :
96+ pb = PBSelfJoinInGroup .decode (pkg .message .buf2 )
97+ return GroupSelfJoined (grp_id = pb .gid , op_uid = pb .operator_uid )
98+ elif typ == 86 :
99+ reader = Reader (pkg .message .buf2 )
100+ grp_id = reader .read_u32 () # it should have more infomation,but i cant guess it
101+ return GroupSelfRequireReject (grp_id , "" )
94102 elif typ == 87 :
95103 pb = PBGroupInvite .decode (pkg .message .buf2 )
96104 return GroupInvite (grp_id = pb .gid , invitor_uid = pb .invitor_uid )
105+ elif typ == 167 :
106+ print (pkg .message .encode ().hex ())
97107 elif typ == 525 :
98108 pb = MemberInviteRequest .decode (pkg .message .buf2 )
99109 if pb .cmd == 87 :
100110 inn = pb .info .inner
101111 return GroupMemberJoinRequest (grp_id = inn .grp_id , uid = inn .uid , invitor_uid = inn .invitor_uid )
102112 elif typ == 0x210 : # friend event, 528 / group file upload notice event
103- if sub_typ == 35 : # friend request
113+ if sub_typ == 35 : # friend request
104114 pb = PBFriendRequest .decode (pkg .message .buf2 )
105115 return FriendRequest (
106116 pkg .response_head .from_uin ,
107117 pb .info .from_uid ,
108118 pkg .response_head .to_uin ,
109119 pb .info .to_uid ,
110120 pb .info .verify ,
111- pb .info .source
121+ pb .info .source ,
112122 )
113- elif sub_typ == 138 : # friend recall
123+ elif sub_typ == 138 : # friend recall
114124 pb = PBFriendRecall .decode (pkg .message .buf2 )
115125 return FriendRecall (
116126 pkg .response_head .from_uin ,
@@ -119,10 +129,16 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
119129 pb .info .to_uid ,
120130 pb .info .seq ,
121131 pb .info .random ,
122- pb .info .time
132+ pb .info .time ,
123133 )
134+ if sub_typ == 368 :
135+ pass
136+ # print(pkg.message.encode().hex())
124137 logger .debug (f"unhandled friend event / group file upload notice event: { pkg } " ) # TODO: paste
125138 elif typ == 0x2DC : # grp event, 732
139+ if sub_typ == 1 :
140+ # print(pkg.encode().hex())
141+ pass
126142 if sub_typ == 20 : # nudge and group_sign(群打卡)
127143 if pkg .message :
128144 grp_id , pb = unpack (pkg .message .buf2 , GroupSub20Head )
@@ -136,14 +152,19 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
136152 attrs [k .decode ()] = int (v .decode ())
137153 else :
138154 attrs [k .decode ()] = v .decode ()
155+ if pb .body .f2 == 19217 :
156+ return GroupBotJoined (
157+ grp_id ,
158+ attrs ["mqq_uin" ],
159+ attrs ["nick_name" ],
160+ attrs ["robot_name" ],
161+ attrs ["robot_schema" ],
162+ attrs ["user_schema" ],
163+ )
139164 if pb .body .type == 1 :
140165 if "invitor" in attrs :
141166 # reserve: attrs["msg_nums"]
142- return GroupMemberJoinedByInvite (
143- grp_id ,
144- attrs ["invitor" ],
145- attrs ["invitee" ]
146- )
167+ return GroupMemberJoinedByInvite (grp_id , attrs ["invitor" ], attrs ["invitee" ])
147168 elif "user" in attrs and "uin" in attrs :
148169 # todo: 群代办
149170 pass
@@ -169,13 +190,17 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
169190 pb .body .attrs_xml ,
170191 )
171192 else :
172- raise ValueError (f"unknown type({ pb .body .type } ) on GroupSub20: { attrs } " )
193+ raise ValueError (f"unknown type({ pb .body .type } ) f2( { pb . body . f2 } ) on GroupSub20: { attrs } " )
173194 else :
174195 # print(pkg.encode().hex(), 2)
175196 return
176197 elif sub_typ == 16 : # rename & special_title & reaction
198+ # print(sso.data.hex())
177199 if pkg .message :
178200 grp_id , pb = unpack (pkg .message .buf2 , GroupSub16Head )
201+ if pb .flag is None :
202+ _ , pb = unpack (pkg .message .buf2 , PBBotGrayTip ) # 傻逼tx,我13号位呢
203+ return BotGrayTip (grp_id , pb .body .message )
179204 if pb .flag == 6 : # special_title
180205 body = MemberGotTitleBody .decode (pb .body )
181206 for el in re .findall (r"<(\{.*?})>" , body .string ):
@@ -222,6 +247,9 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
222247 timestamp = pb .timestamp ,
223248 image_id = q ["i" ],
224249 )
250+ elif pb .flag == 38 :
251+ _ , pb = unpack (pkg .message .buf2 , PBGroupBotAdded )
252+ return GroupBotAdded (pb .body .grp_id , pb .body .bot_uid_1 or pb .body .bot_uid_2 )
225253 else :
226254 raise ValueError (f"Unknown subtype_12 flag: { pb .flag } : { pb .body .hex () if pb .body else pb } " )
227255 elif sub_typ == 17 : # recall
0 commit comments