mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-07 20:45:53 +08:00
fix thumb.
This commit is contained in:
parent
50f0f572bc
commit
eaec0e545f
@ -1021,10 +1021,12 @@ video:
|
||||
b, _ := ioutil.ReadFile(rawPath)
|
||||
r := binary.NewReader(b)
|
||||
return &LocalVideoElement{ShortVideoElement: message.ShortVideoElement{ // todo 检查缓存是否有效
|
||||
Md5: r.ReadBytes(16),
|
||||
Size: r.ReadInt32(),
|
||||
Name: r.ReadString(),
|
||||
Uuid: r.ReadAvailable(),
|
||||
Md5: r.ReadBytes(16),
|
||||
ThumbMd5: r.ReadBytes(16),
|
||||
Size: r.ReadInt32(),
|
||||
ThumbSize: r.ReadInt32(),
|
||||
Name: r.ReadString(),
|
||||
Uuid: r.ReadAvailable(),
|
||||
}}, nil
|
||||
} else {
|
||||
return &LocalVideoElement{File: rawPath}, nil
|
||||
|
@ -566,7 +566,9 @@ func (bot *CQBot) checkMedia(e []message.IMessageElement) {
|
||||
if !global.PathExists(path.Join(global.VIDEO_PATH, filename)) {
|
||||
_ = ioutil.WriteFile(path.Join(global.VIDEO_PATH, filename), binary.NewWriterF(func(w *binary.Writer) {
|
||||
w.Write(i.Md5)
|
||||
w.Write(i.ThumbMd5)
|
||||
w.WriteUInt32(uint32(i.Size))
|
||||
w.WriteUInt32(uint32(i.ThumbSize))
|
||||
w.WriteString(i.Name)
|
||||
w.Write(i.Uuid)
|
||||
}), 0644)
|
||||
|
Loading…
x
Reference in New Issue
Block a user