@@ -144,15 +144,21 @@ async def parse_msg_new(client: "Client", pkg: MsgPushBody) -> Sequence[Element]
144144 index = extra .body [0 ].index
145145 uid = client .uid
146146 gid = pkg .response_head .rsp_grp .gid if common .bus_type == 20 else None
147- url = await client .fetch_image_url (bus_type = cast (Literal [10 , 20 ], common .bus_type ),
148- node = index , uid = uid , gid = gid )
147+ url = await client .fetch_image_url (
148+ bus_type = cast (Literal [10 , 20 ], common .bus_type ),
149+ node = index ,
150+ uid = uid ,
151+ gid = gid ,
152+ )
149153 msg_chain .append (
150154 elems .Image (
151155 name = index .info .name ,
152156 size = index .info .size ,
153157 id = 0 ,
154158 md5 = bytes .fromhex (index .info .hash ),
155- text = extra .biz_info .pic .summary if extra .biz_info .pic .summary else "[图片]" ,
159+ text = extra .biz_info .pic .summary
160+ if extra .biz_info .pic .summary
161+ else "[图片]" ,
156162 width = index .info .width ,
157163 height = index .info .height ,
158164 url = url ,
@@ -173,23 +179,6 @@ async def parse_msg_new(client: "Client", pkg: MsgPushBody) -> Sequence[Element]
173179 elems .Service (id = sid , raw = content , text = f"[service:{ sid } ]" )
174180 )
175181 ignore_next = True
176- # elif 16 in raw: # extra
177- # # nickname = unpack_dict(raw, "16.2", "")
178- # pass
179- # elif 19 in raw: # video
180- # video = raw[19]
181- # msg_chain.append({
182- # "type": "video",
183- # "text": "[视频]",
184- # "name": unpack_dict(video, "3", "undefined"),
185- # "id": unpack_dict(video, "1"), # tlv struct? contain md5, filetype
186- # "md5": unpack_dict(video, "2"),
187- # "width": unpack_dict(video, "7"),
188- # "height": unpack_dict(video, "8"),
189- # "size": unpack_dict(video, "6")
190- # })
191- # elif 37 in raw: # unknown
192- # pass
193182 elif raw .open_data :
194183 msg_chain .append (
195184 elems .Raw (
@@ -247,6 +236,23 @@ async def parse_msg_new(client: "Client", pkg: MsgPushBody) -> Sequence[Element]
247236 # "show_type": typ,
248237 # "id": eid
249238 # })
239+ elif raw .video_file :
240+ video = raw .video_file
241+
242+ msg_chain .append (
243+ elems .Video (
244+ id = 0 ,
245+ time = video .length ,
246+ text = "[视频]" ,
247+ name = video .name ,
248+ size = video .size ,
249+ file_key = video .id ,
250+ md5 = video .video_md5 ,
251+ width = video .width ,
252+ height = video .height ,
253+ qmsg = None ,
254+ )
255+ )
250256 else :
251257 pass
252258 # print("unknown msg", raw)
0 commit comments