From c9939d145b36de057875c44469a62cc407f4d175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:49:48 +0800 Subject: [PATCH] chore: make lint happy --- plugin/drawlots/main.go | 12 ++++++------ plugin/mcfish/pole.go | 10 +++++----- plugin/warframeapi/main.go | 10 +++++----- plugin/wenxinvilg/main.go | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/plugin/drawlots/main.go b/plugin/drawlots/main.go index 67edaea2a9..dde3530d58 100644 --- a/plugin/drawlots/main.go +++ b/plugin/drawlots/main.go @@ -252,17 +252,17 @@ func randGif(gifName string, uid int64) (image.Image, error) { // https://zhuanlan.zhihu.com/p/27718135 rect := image.Rect(0, 0, config.Width, config.Height) if rect.Min == rect.Max { - var max image.Point + var maxP image.Point for _, frame := range im.Image { maxF := frame.Bounds().Max - if max.X < maxF.X { - max.X = maxF.X + if maxP.X < maxF.X { + maxP.X = maxF.X } - if max.Y < maxF.Y { - max.Y = maxF.Y + if maxP.Y < maxF.Y { + maxP.Y = maxF.Y } } - rect.Max = max + rect.Max = maxP } img := image.NewRGBA(rect) b := fcext.RandSenderPerDayN(uid, len(im.Image)) + 1 diff --git a/plugin/mcfish/pole.go b/plugin/mcfish/pole.go index b918568f6b..cad6938975 100644 --- a/plugin/mcfish/pole.go +++ b/plugin/mcfish/pole.go @@ -361,12 +361,12 @@ func init() { ctx.SendChain(message.Text("[ERROR at pole.go.10]:", err)) return } - max := len(articles) - if max < 3 { + maxCount := len(articles) + if maxCount < 3 { ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("你的合成材料不足")) return } - poles := make([]equip, 0, max) + poles := make([]equip, 0, maxCount) for _, info := range articles { poleInfo := strings.Split(info.Other, "/") durable, _ := strconv.Atoi(poleInfo[0]) @@ -447,8 +447,8 @@ func init() { ctx.SendChain(message.At(ctx.Event.UserID), message.Text("[0]请输入正确的序号\n", list)) continue } - if first >= max || second >= max || third >= max { - ctx.SendChain(message.At(ctx.Event.UserID), message.Text("[", max, "]请输入正确的序号\n", list)) + if first >= maxCount || second >= maxCount || third >= maxCount { + ctx.SendChain(message.At(ctx.Event.UserID), message.Text("[", maxCount, "]请输入正确的序号\n", list)) continue } check = true diff --git a/plugin/warframeapi/main.go b/plugin/warframeapi/main.go index 1fb04d4eda..94865c9209 100644 --- a/plugin/warframeapi/main.go +++ b/plugin/warframeapi/main.go @@ -321,9 +321,9 @@ func init() { } ismod := iteminfo.ModMaxRank != 0 - max := 5 - if len(sells) < max { - max = len(sells) + maxCount := 5 + if len(sells) < maxCount { + maxCount = len(sells) } sb := strings.Builder{} if ismod { @@ -332,13 +332,13 @@ func init() { } else { 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, // 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)) } } else { - for i := 0; i < max; i++ { + for i := 0; i < maxCount; i++ { // msgs = append(msgs, ctxext.FakeSenderForwardNode(ctx, // 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)) diff --git a/plugin/wenxinvilg/main.go b/plugin/wenxinvilg/main.go index 701a7eb468..24be484b5e 100644 --- a/plugin/wenxinvilg/main.go +++ b/plugin/wenxinvilg/main.go @@ -415,14 +415,14 @@ func init() { // 插件主体 minlen := 1 maxlen := 128 if mun != "" { - max, err := strconv.Atoi(mun) + maxNum, err := strconv.Atoi(mun) if err != nil { ctx.SendChain(message.Text(modelErr, err)) return } - minlen = max - if max > 128 { - maxlen = max + minlen = maxNum + if maxNum > 128 { + maxlen = maxNum } } keyword := ctx.State["regex_matched"].([]string)[4]