From 58bc1758ec083d3ef341fbb4254bb86491123223 Mon Sep 17 00:00:00 2001 From: fumiama Date: Fri, 6 Aug 2021 18:11:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A9=F0=9F=91=8C=20make=20lint=20happy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_diana/bing.go | 3 ++- plugin_diana/zhiwang.go | 4 ++-- plugin_image_finder/keyword.go | 1 + plugin_minecraft/manager.go | 1 + plugin_setutime/setu_geter.go | 5 +++-- plugin_setutime/sqlite.go | 10 ++++++++-- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/plugin_diana/bing.go b/plugin_diana/bing.go index 8ebc996d..2b576fa2 100644 --- a/plugin_diana/bing.go +++ b/plugin_diana/bing.go @@ -65,9 +65,10 @@ func init() { }) // 逆天 + // \u200b 是 🥵 的转义 zero.OnFullMatch("发大病", zero.OnlyToMe). Handle(func(ctx *zero.Ctx) { - ctx.Send("贝拉抽我🥵嘉然骑在我背上🥵晚晚踩我🥵乃琳坐在王座是用看垃圾的眼神看我🥵🥵珈乐踢我🥵🥵,把我眼睛蒙住然后五只脚一起踩我🥵还让我猜脚是谁的,猜错了给我劈眼一铁棍🥵​") + ctx.Send("贝拉抽我\u200b嘉然骑在我背上\u200b晚晚踩我\u200b乃琳坐在王座是用看垃圾的眼神看我\u200b\u200b珈乐踢我\u200b\u200b,把我眼睛蒙住然后五只脚一起踩我\u200b还让我猜脚是谁的,猜错了给我劈眼一铁棍\u200b​") }) // 增加小作文 zero.OnRegex(`^教你一篇小作文(.*)$`, zero.AdminPermission). diff --git a/plugin_diana/zhiwang.go b/plugin_diana/zhiwang.go index 3d968b25..52ca3967 100644 --- a/plugin_diana/zhiwang.go +++ b/plugin_diana/zhiwang.go @@ -65,10 +65,10 @@ func init() { } // 发起api请求并把返回body交由json库解析 -func zhiwangapi(Text string) *zhiwang { +func zhiwangapi(text string) *zhiwang { url := "https://asoulcnki.asia/v1/api/check" - post := "{\n\"text\":\"" + Text + "\"\n}" + post := "{\n\"text\":\"" + text + "\"\n}" var jsonStr = []byte(post) req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) diff --git a/plugin_image_finder/keyword.go b/plugin_image_finder/keyword.go index 4e49eefd..a5764416 100644 --- a/plugin_image_finder/keyword.go +++ b/plugin_image_finder/keyword.go @@ -1,3 +1,4 @@ +// Package imagefinder 关键字搜图 package imagefinder import ( diff --git a/plugin_minecraft/manager.go b/plugin_minecraft/manager.go index b82c01da..39149b38 100644 --- a/plugin_minecraft/manager.go +++ b/plugin_minecraft/manager.go @@ -1,3 +1,4 @@ +// Package minecraft MCSManager package minecraft import ( diff --git a/plugin_setutime/setu_geter.go b/plugin_setutime/setu_geter.go index 0fd46873..a9448da9 100644 --- a/plugin_setutime/setu_geter.go +++ b/plugin_setutime/setu_geter.go @@ -150,7 +150,7 @@ func init() { // 插件主体 Handle(func(ctx *zero.Ctx) { state := []string{"[SetuTime]"} for i := range pool.List { - num, err := pool.DB.num(pool.List[i]) + num, err := pool.DB.count(pool.List[i]) if err != nil { num = 0 } @@ -193,10 +193,11 @@ func (p *imgpool) size(imgtype string) int { return len(p.Pool[imgtype]) } +/* // isFull 返回缓冲池指定类型是否已满 func (p *imgpool) isFull(imgtype string) bool { return len(p.Pool[imgtype]) >= p.Max -} +}*/ // push 向缓冲池插入一张图片 func (p *imgpool) push(imgtype string, illust *pixiv.Illust) { diff --git a/plugin_setutime/sqlite.go b/plugin_setutime/sqlite.go index f725cf4f..e0a2de6a 100644 --- a/plugin_setutime/sqlite.go +++ b/plugin_setutime/sqlite.go @@ -125,6 +125,9 @@ func (db *sqlite) find(table string, objptr interface{}, condition string) (err if err != nil { return err } + if rows.Err() != nil { + return rows.Err() + } defer rows.Close() for rows.Next() { @@ -158,9 +161,9 @@ func (db *sqlite) del(table string, condition string) (err error) { return nil } -// num 查询数据库行数 +// count 查询数据库行数 // 返回行数以及错误 -func (db *sqlite) num(table string) (num int, err error) { +func (db *sqlite) count(table string) (num int, err error) { var cmd = []string{} cmd = append(cmd, "SELECT * FROM") cmd = append(cmd, table) @@ -168,6 +171,9 @@ func (db *sqlite) num(table string) (num int, err error) { if err != nil { return num, err } + if rows.Err() != nil { + return num, rows.Err() + } defer rows.Close() for rows.Next() { num++