chore: make lint happy

This commit is contained in:
源文雨 2024-08-19 19:49:48 +08:00
parent 852c5f2f35
commit c9939d145b
4 changed files with 20 additions and 20 deletions

View File

@ -252,17 +252,17 @@ func randGif(gifName string, uid int64) (image.Image, error) {
// https://zhuanlan.zhihu.com/p/27718135 // https://zhuanlan.zhihu.com/p/27718135
rect := image.Rect(0, 0, config.Width, config.Height) rect := image.Rect(0, 0, config.Width, config.Height)
if rect.Min == rect.Max { if rect.Min == rect.Max {
var max image.Point var maxP image.Point
for _, frame := range im.Image { for _, frame := range im.Image {
maxF := frame.Bounds().Max maxF := frame.Bounds().Max
if max.X < maxF.X { if maxP.X < maxF.X {
max.X = maxF.X maxP.X = maxF.X
} }
if max.Y < maxF.Y { if maxP.Y < maxF.Y {
max.Y = maxF.Y maxP.Y = maxF.Y
} }
} }
rect.Max = max rect.Max = maxP
} }
img := image.NewRGBA(rect) img := image.NewRGBA(rect)
b := fcext.RandSenderPerDayN(uid, len(im.Image)) + 1 b := fcext.RandSenderPerDayN(uid, len(im.Image)) + 1

View File

@ -361,12 +361,12 @@ func init() {
ctx.SendChain(message.Text("[ERROR at pole.go.10]:", err)) ctx.SendChain(message.Text("[ERROR at pole.go.10]:", err))
return return
} }
max := len(articles) maxCount := len(articles)
if max < 3 { if maxCount < 3 {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("你的合成材料不足")) ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("你的合成材料不足"))
return return
} }
poles := make([]equip, 0, max) poles := make([]equip, 0, maxCount)
for _, info := range articles { for _, info := range articles {
poleInfo := strings.Split(info.Other, "/") poleInfo := strings.Split(info.Other, "/")
durable, _ := strconv.Atoi(poleInfo[0]) durable, _ := strconv.Atoi(poleInfo[0])
@ -447,8 +447,8 @@ func init() {
ctx.SendChain(message.At(ctx.Event.UserID), message.Text("[0]请输入正确的序号\n", list)) ctx.SendChain(message.At(ctx.Event.UserID), message.Text("[0]请输入正确的序号\n", list))
continue continue
} }
if first >= max || second >= max || third >= max { if first >= maxCount || second >= maxCount || third >= maxCount {
ctx.SendChain(message.At(ctx.Event.UserID), message.Text("[", max, "]请输入正确的序号\n", list)) ctx.SendChain(message.At(ctx.Event.UserID), message.Text("[", maxCount, "]请输入正确的序号\n", list))
continue continue
} }
check = true check = true

View File

@ -321,9 +321,9 @@ func init() {
} }
ismod := iteminfo.ModMaxRank != 0 ismod := iteminfo.ModMaxRank != 0
max := 5 maxCount := 5
if len(sells) < max { if len(sells) < maxCount {
max = len(sells) maxCount = len(sells)
} }
sb := strings.Builder{} sb := strings.Builder{}
if ismod { if ismod {
@ -332,13 +332,13 @@ func init() {
} else { } else {
msgs = append(msgs, ctxext.FakeSenderForwardNode(ctx, message.Text("请输入编号选择(30s内)\n输入c直接结束会话"))) msgs = append(msgs, ctxext.FakeSenderForwardNode(ctx, message.Text("请输入编号选择(30s内)\n输入c直接结束会话")))
} }
for i := 0; i < max; i++ { for i := 0; i < maxCount; i++ {
// msgs = append(msgs, ctxext.FakeSenderForwardNode(ctx, // msgs = append(msgs, ctxext.FakeSenderForwardNode(ctx,
// message.Text(fmt.Sprintf("[%d] (Rank:%d/%d) %dP - %s\n", i, sells[i].ModRank, iteminfo.ModMaxRank, sells[i].Platinum, sells[i].User.IngameName)))) // message.Text(fmt.Sprintf("[%d] (Rank:%d/%d) %dP - %s\n", i, sells[i].ModRank, iteminfo.ModMaxRank, sells[i].Platinum, sells[i].User.IngameName))))
sb.WriteString(fmt.Sprintf("[%d] (Rank:%d/%d) %dP - %s\n", i, sells[i].ModRank, iteminfo.ModMaxRank, sells[i].Platinum, sells[i].User.IngameName)) sb.WriteString(fmt.Sprintf("[%d] (Rank:%d/%d) %dP - %s\n", i, sells[i].ModRank, iteminfo.ModMaxRank, sells[i].Platinum, sells[i].User.IngameName))
} }
} else { } else {
for i := 0; i < max; i++ { for i := 0; i < maxCount; i++ {
// msgs = append(msgs, ctxext.FakeSenderForwardNode(ctx, // msgs = append(msgs, ctxext.FakeSenderForwardNode(ctx,
// message.Text(fmt.Sprintf("[%d] %dP -%s\n", i, sells[i].Platinum, sells[i].User.IngameName)))) // message.Text(fmt.Sprintf("[%d] %dP -%s\n", i, sells[i].Platinum, sells[i].User.IngameName))))
sb.WriteString(fmt.Sprintf("[%d] %dP -%s\n", i, sells[i].Platinum, sells[i].User.IngameName)) sb.WriteString(fmt.Sprintf("[%d] %dP -%s\n", i, sells[i].Platinum, sells[i].User.IngameName))

View File

@ -415,14 +415,14 @@ func init() { // 插件主体
minlen := 1 minlen := 1
maxlen := 128 maxlen := 128
if mun != "" { if mun != "" {
max, err := strconv.Atoi(mun) maxNum, err := strconv.Atoi(mun)
if err != nil { if err != nil {
ctx.SendChain(message.Text(modelErr, err)) ctx.SendChain(message.Text(modelErr, err))
return return
} }
minlen = max minlen = maxNum
if max > 128 { if maxNum > 128 {
maxlen = max maxlen = maxNum
} }
} }
keyword := ctx.State["regex_matched"].([]string)[4] keyword := ctx.State["regex_matched"].([]string)[4]