Skip to content

Commit

Permalink
chore: make lint happy #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan04 committed Nov 11, 2024
1 parent e6d4af8 commit 5aca232
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions coolq/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,12 @@ func (bot *CQBot) checkMedia(e []message.IMessageElement, source message.Source)
// }
//}
data := binary.NewWriterF(func(w *binary.Builder) {
w.Write(i.Md5)
_, err := w.Write(i.Md5)
if err != nil {
log.Warnf("计算图片md5时出现错误: %v", err)
return
}

w.WritePacketString(i.FileUUID, "u32", true)
w.WritePacketString(i.ImageID, "u32", true)
})
Expand All @@ -560,8 +565,12 @@ func (bot *CQBot) checkMedia(e []message.IMessageElement, source message.Source)
}
case *message.ShortVideoElement:
data := binary.NewWriterF(func(w *binary.Builder) {
w.Write(i.Md5)
w.Write(i.Sha1)
_, err := w.Write(i.Md5)
_, err = w.Write(i.Sha1)
if err != nil {
log.Warnf("计算视频sha1时出现错误: %v", err)
return
}
w.WritePacketString(i.Name, "u32", true)
w.WritePacketBytes(i.UUID, "u32", true)
})
Expand Down

0 comments on commit 5aca232

Please sign in to comment.