1414 MemberRecallMsg ,
1515 GroupSub20Head ,
1616)
17- from lagrange .utils .binary .protobuf import proto_decode , ProtoStruct
17+ from lagrange .utils .binary .protobuf import proto_decode , ProtoStruct , proto_encode
1818from lagrange .utils .binary .reader import Reader
1919from lagrange .utils .operator import unpack_dict
2020
@@ -87,29 +87,38 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
8787 elif typ == 0x210 : # frd event
8888 logger .debug ("unhandled friend event: %s" % pkg )
8989 elif typ == 0x2DC : # grp event, 732
90- if sub_typ == 20 : # nudget(grp_id only )
90+ if sub_typ == 20 : # nudge and group_sign(群打卡 )
9191 if pkg .message :
9292 grp_id , pb = unpack (pkg .message .buf2 , GroupSub20Head )
9393 attrs : Dict [str , Union [str , int ]] = {}
9494 for x in pb .body .attrs : # type: dict[bytes, bytes]
9595 k , v = x .values ()
96+ if isinstance (v , dict ):
97+ v = proto_encode (v )
9698 if v .isdigit ():
9799 attrs [k .decode ()] = int (v .decode ())
98100 else :
99101 attrs [k .decode ()] = v .decode ()
100- return GroupNudge (
101- grp_id ,
102- attrs ["uin_str1" ],
103- attrs ["uin_str2" ],
104- attrs ["action_str" ],
105- attrs ["suffix_str" ],
106- attrs ,
107- pb .body .attrs_xml ,
108- )
102+ if pb .body .type == 12 :
103+ return GroupNudge (
104+ grp_id ,
105+ attrs ["uin_str1" ],
106+ attrs ["uin_str2" ],
107+ attrs ["action_str" ],
108+ attrs ["suffix_str" ],
109+ attrs ,
110+ pb .body .attrs_xml ,
111+ )
112+ elif pb .body .type == 14 : # grp_sign
113+ pass
114+ else :
115+ raise ValueError (
116+ f"unknown type({ pb .body .type } ) on GroupSub20: { attrs } "
117+ )
109118 else :
110119 # print(pkg.encode().hex(), 2)
111120 return
112- elif sub_typ == 16 : # rename and special_title and reaction
121+ elif sub_typ == 16 : # rename & special_title & reaction
113122 if pkg .message :
114123 grp_id , pb = unpack (pkg .message .buf2 , GroupSub16Head )
115124 if pb .flag == 6 : # special_title
@@ -136,7 +145,7 @@ async def msg_push_handler(client: "Client", sso: SSOPacket):
136145 timestamp = pb .timestamp ,
137146 operator_uid = pb .operator_uid ,
138147 )
139- elif pb .flag == 35 : # add reaction
148+ elif pb .flag == 35 : # set reaction
140149 body = pb .f44 .inner .body
141150 return GroupReaction (
142151 grp_id = grp_id ,
0 commit comments