1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

proper flash pic support

This commit is contained in:
wfjsw 2020-11-09 00:37:48 +08:00
parent ca72d542ca
commit a84b524889
3 changed files with 34 additions and 17 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea .idea
vendor/

View File

@ -2,10 +2,11 @@ package message
import ( import (
"fmt" "fmt"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
"strconv" "strconv"
"strings" "strings"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
) )
type TextElement struct { type TextElement struct {
@ -112,6 +113,12 @@ type RedBagElement struct {
Title string Title string
} }
// TODO: 总之就是非常傻逼
type GroupFlashImgElement struct {
ImageElement
}
type GroupFlashPicElement struct { type GroupFlashPicElement struct {
GroupImageElement GroupImageElement
} }
@ -121,6 +128,10 @@ type GroupShowPicElement struct {
EffectId int32 EffectId int32
} }
type FriendFlashImgElement struct {
ImageElement
}
type FriendFlashPicElement struct { type FriendFlashPicElement struct {
FriendImageElement FriendImageElement
} }

View File

@ -2,16 +2,17 @@ package message
import ( import (
"crypto/md5" "crypto/md5"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
"github.com/Mrs4s/MiraiGo/utils"
"github.com/golang/protobuf/proto"
"github.com/tidwall/gjson"
"math" "math"
"reflect" "reflect"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
"github.com/Mrs4s/MiraiGo/utils"
"github.com/golang/protobuf/proto"
"github.com/tidwall/gjson"
) )
type ( type (
@ -480,19 +481,23 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
flash := &msg.MsgElemInfoServtype3{} flash := &msg.MsgElemInfoServtype3{}
_ = proto.Unmarshal(elem.CommonElem.PbElem, flash) _ = proto.Unmarshal(elem.CommonElem.PbElem, flash)
if flash.FlashTroopPic != nil { if flash.FlashTroopPic != nil {
res = append(res, &ImageElement{ res = append(res, &GroupFlashImgElement{
ImageElement{
Filename: flash.FlashTroopPic.FilePath, Filename: flash.FlashTroopPic.FilePath,
Size: flash.FlashTroopPic.Size, Size: flash.FlashTroopPic.Size,
Width: flash.FlashTroopPic.Width, Width: flash.FlashTroopPic.Width,
Height: flash.FlashTroopPic.Height, Height: flash.FlashTroopPic.Height,
Md5: flash.FlashTroopPic.Md5, Md5: flash.FlashTroopPic.Md5,
},
}) })
} }
if flash.FlashC2CPic != nil { if flash.FlashC2CPic != nil {
res = append(res, &ImageElement{ res = append(res, &GroupFlashImgElement{
ImageElement{
Filename: flash.FlashC2CPic.FilePath, Filename: flash.FlashC2CPic.FilePath,
Size: flash.FlashC2CPic.FileLen, Size: flash.FlashC2CPic.FileLen,
Md5: flash.FlashC2CPic.PicMd5, Md5: flash.FlashC2CPic.PicMd5,
},
}) })
} }
} }