@@ -243,6 +243,16 @@ func toElements(e []message.IMessageElement, source message.Source) (r []msg.Ele
243
243
{K : "type" , V : "sticker" },
244
244
},
245
245
}
246
+ case * message.GroupFileElement :
247
+ m = msg.Element {
248
+ Type : "file" ,
249
+ Data : pairs {
250
+ {K : "path" , V : o .Path },
251
+ {K : "name" , V : o .Name },
252
+ {K : "size" , V : strconv .FormatInt (o .Size , 10 )},
253
+ {K : "busid" , V : strconv .FormatInt (int64 (o .Busid ), 10 )},
254
+ },
255
+ }
246
256
case * msg.LocalImage :
247
257
data := pairs {
248
258
{K : "file" , V : o .File },
@@ -378,6 +388,11 @@ func ToMessageContent(e []message.IMessageElement, source message.Source) (r []g
378
388
"type" : "face" ,
379
389
"data" : global.MSG {"id" : o .ID , "type" : "sticker" },
380
390
}
391
+ case * message.GroupFileElement :
392
+ m = global.MSG {
393
+ "type" : "file" ,
394
+ "data" : global.MSG {"path" : o .Path , "name" : o .Name , "size" : strconv .FormatInt (o .Size , 10 ), "busid" : strconv .FormatInt (int64 (o .Busid ), 10 )},
395
+ }
381
396
default :
382
397
continue
383
398
}
@@ -849,6 +864,17 @@ func (bot *CQBot) ConvertElement(spec *onebot.Spec, elem msg.Element, sourceType
849
864
v .File = cacheFile
850
865
}
851
866
return v , nil
867
+ case "file" :
868
+ path := elem .Get ("path" )
869
+ name := elem .Get ("name" )
870
+ size , _ := strconv .ParseInt (elem .Get ("size" ), 10 , 64 )
871
+ busid , _ := strconv .ParseInt (elem .Get ("busid" ), 10 , 64 )
872
+ return & message.GroupFileElement {
873
+ Name : name ,
874
+ Size : size ,
875
+ Path : path ,
876
+ Busid : int32 (busid ),
877
+ }, nil
852
878
default :
853
879
return nil , errors .New ("unsupported message type: " + elem .Type )
854
880
}
0 commit comments