1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

fix: guild image type error

This commit is contained in:
Mrs4s 2021-11-13 02:30:36 +08:00
parent 7b125259d6
commit d3a21e577b
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7

View File

@ -443,18 +443,31 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
if len(elem.CustomFace.Md5) == 0 { if len(elem.CustomFace.Md5) == 0 {
continue continue
} }
url := func() string {
if elem.CustomFace.GetOrigUrl() == "" {
return "https://gchat.qpic.cn/gchatpic_new/0/0-0-" + strings.ReplaceAll(binary.CalculateImageResourceId(elem.CustomFace.Md5)[1:37], "-", "") + "/0?term=2"
}
return "https://gchat.qpic.cn" + elem.CustomFace.GetOrigUrl()
}()
if strings.Contains(elem.CustomFace.GetOrigUrl(), "qmeet") {
res = append(res, &GuildImageElement{
FileId: int64(elem.CustomFace.GetFileId()),
FilePath: elem.CustomFace.GetFilePath(),
Size: elem.CustomFace.GetSize(),
Width: elem.CustomFace.GetWidth(),
Height: elem.CustomFace.GetHeight(),
Url: url,
Md5: elem.CustomFace.Md5,
})
continue
}
res = append(res, &GroupImageElement{ res = append(res, &GroupImageElement{
FileId: int64(elem.CustomFace.GetFileId()), FileId: int64(elem.CustomFace.GetFileId()),
ImageId: elem.CustomFace.GetFilePath(), ImageId: elem.CustomFace.GetFilePath(),
Size: elem.CustomFace.GetSize(), Size: elem.CustomFace.GetSize(),
Width: elem.CustomFace.GetWidth(), Width: elem.CustomFace.GetWidth(),
Height: elem.CustomFace.GetHeight(), Height: elem.CustomFace.GetHeight(),
Url: func() string { Url: url,
if elem.CustomFace.GetOrigUrl() == "" {
return "https://gchat.qpic.cn/gchatpic_new/0/0-0-" + strings.ReplaceAll(binary.CalculateImageResourceId(elem.CustomFace.Md5)[1:37], "-", "") + "/0?term=2"
}
return "https://gchat.qpic.cn" + elem.CustomFace.GetOrigUrl()
}(),
ImageBizType: func() ImageBizType { ImageBizType: func() ImageBizType {
if len(elem.CustomFace.PbReserve) == 0 { if len(elem.CustomFace.PbReserve) == 0 {
return UnknownBizType return UnknownBizType