@@ -17,22 +17,38 @@ export async function decodeMultiMessage(ctx: Context, items: InferProtoModel<ty
1717 text : element . text . str !
1818 }
1919 }
20- } else if ( element . commonElem && element . commonElem . serviceType === 48 ) {
21- const richMediaInfo = Media . MsgInfo . decode ( element . commonElem . pbElem )
22- const infoBody = richMediaInfo . msgInfoBody [ 0 ]
23- const parsedUrl = new URL ( 'https://' + infoBody . pic ! . domain + infoBody . pic ! . urlPath + infoBody . pic ! . ext ! . originalParam )
24- const imageAppid = parsedUrl . searchParams . get ( 'appid' )
25- const rkeyData = await ctx . ntFileApi . rkeyManager . getRkey ( )
26- const url = parsedUrl . href + ( imageAppid === '1406' ? rkeyData . private_rkey : rkeyData . group_rkey )
27- const { info } = richMediaInfo . msgInfoBody [ 0 ] . index !
28- const { pic } = richMediaInfo . extBizInfo !
29- segment = {
30- type : OB11MessageDataType . Image ,
31- data : {
32- file : info ! . fileName ! ,
33- subType : pic ! . bizType ! ,
34- url,
35- file_size : info ! . fileSize ! . toString ( ) ,
20+ } else if ( element . commonElem ) {
21+ const { businessType, serviceType, pbElem } = element . commonElem
22+ if ( serviceType === 48 && ( businessType === 10 || businessType === 20 ) ) {
23+ const richMediaInfo = Media . MsgInfo . decode ( pbElem )
24+ const infoBody = richMediaInfo . msgInfoBody [ 0 ]
25+ const parsedUrl = new URL ( 'https://' + infoBody . pic ! . domain + infoBody . pic ! . urlPath + infoBody . pic ! . ext ! . originalParam )
26+ const imageAppid = parsedUrl . searchParams . get ( 'appid' )
27+ const rkeyData = await ctx . ntFileApi . rkeyManager . getRkey ( )
28+ const url = parsedUrl . href + ( imageAppid === '1406' ? rkeyData . private_rkey : rkeyData . group_rkey )
29+ const { info } = richMediaInfo . msgInfoBody [ 0 ] . index !
30+ const { pic } = richMediaInfo . extBizInfo !
31+ segment = {
32+ type : OB11MessageDataType . Image ,
33+ data : {
34+ file : info ! . fileName ! ,
35+ subType : pic ! . bizType ! ,
36+ url,
37+ file_size : info ! . fileSize ! . toString ( ) ,
38+ }
39+ }
40+ } else if ( serviceType === 48 && ( businessType === 11 || businessType === 21 ) ) {
41+ const { msgInfoBody } = Media . MsgInfo . decode ( pbElem )
42+ const { index } = msgInfoBody [ 0 ]
43+ const url = await ctx . ntFileApi . getVideoUrlByPacket ( index . fileUuid , businessType === 21 )
44+ segment = {
45+ type : OB11MessageDataType . Video ,
46+ data : {
47+ file : index . info . fileName ,
48+ url,
49+ path : '' ,
50+ file_size : index . info . fileSize . toString ( ) ,
51+ }
3652 }
3753 }
3854 }
0 commit comments