diff --git a/plugin/ai_false/ai_false.go b/plugin/ai_false/ai_false.go index cdb3462b..34309c07 100644 --- a/plugin/ai_false/ai_false.go +++ b/plugin/ai_false/ai_false.go @@ -50,34 +50,34 @@ func init() { // 插件主体 Handle(func(ctx *zero.Ctx) { c, ok := ctx.State["manager"].(*ctrl.Control[*zero.Ctx]) if !ok { - ctx.SendChain(message.Text("ERROR:no such plugin")) + ctx.SendChain(message.Text("ERROR: no such plugin")) return } m, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if ctx.State["regex_matched"].([]string)[2] == "分钟" { m *= 60 } if m >= 65536 || m <= 0 { - ctx.SendChain(message.Text("ERROR:interval too big")) + ctx.SendChain(message.Text("ERROR: interval too big")) return } n, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[3], 10, 64) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if n >= 65536 || n <= 0 { - ctx.SendChain(message.Text("ERROR:burst too big")) + ctx.SendChain(message.Text("ERROR: burst too big")) return } ctxext.SetDefaultLimiterManagerParam(time.Duration(m)*time.Second, int(n)) err = c.SetData(0, (m&0xffff)|((n<<16)&0xffff0000)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("设置默认限速为每", m, "秒触发", n, "次")) diff --git a/plugin/ai_reply/ai_tts.go b/plugin/ai_reply/ai_tts.go index adf9b4d3..a8ea831c 100644 --- a/plugin/ai_reply/ai_tts.go +++ b/plugin/ai_reply/ai_tts.go @@ -64,7 +64,7 @@ func init() { r := aireply.NewAIReply(getReplyMode(ctx)) tts, err := t.new(t.getSoundMode(ctx)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } var reply string diff --git a/plugin/bilibili/bilibili.go b/plugin/bilibili/bilibili.go index e7c2742b..9316acf6 100644 --- a/plugin/bilibili/bilibili.go +++ b/plugin/bilibili/bilibili.go @@ -49,7 +49,7 @@ func init() { _, _ = engine.GetLazyData("bilibili.db", false) vdb, err = initializeVup(engine.DataFolder() + "bilibili.db") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } return true @@ -60,7 +60,7 @@ func init() { id := ctx.State["uid"].(string) card, err := getMemberCard(id) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text( @@ -79,7 +79,7 @@ func init() { // 获取详情 fo, err := getVtbDetail(id) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text( @@ -107,19 +107,19 @@ func init() { } u, err := getMemberCard(id) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } vups, err := vdb.filterVup(u.Attentions) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } vupLen := len(vups) medals, err := getMedalwall(id) sort.Sort(medalSlice(medals)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } frontVups := make([]vup, 0) medalMap := make(map[int64]medal) @@ -147,12 +147,12 @@ func init() { if path.Ext(u.Face) != ".webp" { err = initFacePic(facePath, u.Face) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } back, err = gg.LoadImage(facePath) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } back = img.Size(back, backX, backY).Im @@ -171,10 +171,10 @@ func init() { canvas.SetColor(color.Black) _, err = file.GetLazyData(text.BoldFontFile, true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } if err = canvas.LoadFontFace(text.BoldFontFile, fontSize); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } sl, _ := canvas.MeasureString("好") @@ -248,7 +248,7 @@ func init() { _, err = writer.WriteTo(canvas.Image(), f) _ = f.Close() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + drawedFile)) @@ -259,7 +259,7 @@ func init() { cookie := ctx.State["regex_matched"].([]string)[1] err := vdb.setBilibiliCookie(cookie) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("成功设置b站cookie为" + cookie)) @@ -270,7 +270,7 @@ func init() { ctx.SendChain(message.Text("少女祈祷中...")) err := updateVup() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("vup已更新")) @@ -303,7 +303,7 @@ func getPara(ctx *zero.Ctx) bool { if !re.MatchString(keyword) { searchRes, err := searchUser(keyword) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } ctx.State["uid"] = strconv.FormatInt(searchRes[0].Mid, 10) @@ -336,7 +336,7 @@ func getPara(ctx *zero.Ctx) bool { } else if num == 1 { searchRes, err := searchUser(keyword) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } ctx.State["uid"] = strconv.FormatInt(searchRes[0].Mid, 10) diff --git a/plugin/bilibili/bilibili_parse.go b/plugin/bilibili/bilibili_parse.go index 0f8f1fe7..886eecc0 100644 --- a/plugin/bilibili/bilibili_parse.go +++ b/plugin/bilibili/bilibili_parse.go @@ -67,12 +67,12 @@ func handleVideo(ctx *zero.Ctx) { } card, err := getVideoInfo(id) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } msg, err := videoCard2msg(card) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(msg...) @@ -81,7 +81,7 @@ func handleVideo(ctx *zero.Ctx) { func handleDynamic(ctx *zero.Ctx) { msg, err := dynamicDetail(ctx.State["regex_matched"].([]string)[2]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(msg...) @@ -90,7 +90,7 @@ func handleDynamic(ctx *zero.Ctx) { func handleArticle(ctx *zero.Ctx) { card, err := getArticleInfo(ctx.State["regex_matched"].([]string)[1]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(articleCard2msg(card, ctx.State["regex_matched"].([]string)[1])...) @@ -99,7 +99,7 @@ func handleArticle(ctx *zero.Ctx) { func handleLive(ctx *zero.Ctx) { card, err := getLiveRoomInfo(ctx.State["regex_matched"].([]string)[1]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(liveCard2msg(card)...) diff --git a/plugin/bilibili/bilibilipush.go b/plugin/bilibili/bilibilipush.go index 9b687d0b..eeadecf1 100644 --- a/plugin/bilibili/bilibilipush.go +++ b/plugin/bilibili/bilibilipush.go @@ -58,7 +58,7 @@ func init() { buid, _ := strconv.ParseInt(ctx.State["uid"].(string), 10, 64) name, err := getName(buid) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } gid := ctx.Event.GroupID @@ -66,7 +66,7 @@ func init() { gid = -ctx.Event.UserID } if err := subscribe(buid, gid); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("已添加" + name + "的订阅")) @@ -75,7 +75,7 @@ func init() { buid, _ := strconv.ParseInt(ctx.State["uid"].(string), 10, 64) name, err := getName(buid) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } gid := ctx.Event.GroupID @@ -83,7 +83,7 @@ func init() { gid = -ctx.Event.UserID } if err := unsubscribe(buid, gid); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("已取消" + name + "的订阅")) @@ -92,7 +92,7 @@ func init() { buid, _ := strconv.ParseInt(ctx.State["uid"].(string), 10, 64) name, err := getName(buid) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } gid := ctx.Event.GroupID @@ -100,7 +100,7 @@ func init() { gid = -ctx.Event.UserID } if err := unsubscribeDynamic(buid, gid); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("已取消" + name + "的动态订阅")) @@ -113,11 +113,11 @@ func init() { } name, err := getName(buid) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if err := unsubscribeLive(buid, gid); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("已取消" + name + "的直播订阅")) @@ -149,11 +149,11 @@ func init() { } data, err := text.RenderToBase64(msg, text.FontFile, 600, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Image("base64://" + binary.BytesToString(data))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } }) en.OnFullMatch("拉取b站推送").SetBlock(true).Handle(func(ctx *zero.Ctx) { diff --git a/plugin/book_review/book_review.go b/plugin/book_review/book_review.go index a481b81f..ba55d238 100644 --- a/plugin/book_review/book_review.go +++ b/plugin/book_review/book_review.go @@ -28,17 +28,17 @@ func init() { _, _ = engine.GetLazyData("bookreview.db", true) err := db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("bookreview", &book{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } n, err := db.Count("bookreview") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } log.Infof("[bookreview]读取%d条书评", n) @@ -51,11 +51,11 @@ func init() { b := getBookReviewByKeyword(ctx.State["regex_matched"].([]string)[1]) data, err := text.RenderToBase64(b.BookReview, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Image("base64://" + binary.BytesToString(data))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } }) @@ -64,11 +64,11 @@ func init() { br := getRandomBookReview() data, err := text.RenderToBase64(br.BookReview, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Image("base64://" + binary.BytesToString(data))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } }) } diff --git a/plugin/cangtoushi/cangtoushi.go b/plugin/cangtoushi/cangtoushi.go index 9f5dea68..595441a0 100644 --- a/plugin/cangtoushi/cangtoushi.go +++ b/plugin/cangtoushi/cangtoushi.go @@ -39,17 +39,17 @@ func init() { kw := ctx.State["regex_matched"].([]string)[1] err := login() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } data, err := search(kw, "7", "0") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } text, err := dealHTML(helper.BytesToString(data)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text(text)) @@ -59,17 +59,17 @@ func init() { kw := ctx.State["regex_matched"].([]string)[1] err := login() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } data, err := search(kw, "7", "2") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } text, err := dealHTML(helper.BytesToString(data)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text(text)) diff --git a/plugin/chouxianghua/chouxianghua.go b/plugin/chouxianghua/chouxianghua.go index 2078a71e..9dfcd1a2 100644 --- a/plugin/chouxianghua/chouxianghua.go +++ b/plugin/chouxianghua/chouxianghua.go @@ -27,17 +27,17 @@ func init() { _, _ = en.GetLazyData("cxh.db", true) err := db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("pinyin", &pinyin{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } n, err := db.Count("pinyin") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Printf("[chouxianghua]读取%d条拼音", n) diff --git a/plugin/coser/coser.go b/plugin/coser/coser.go index 3d074550..8d05b903 100644 --- a/plugin/coser/coser.go +++ b/plugin/coser/coser.go @@ -31,7 +31,7 @@ func init() { ctx.SendChain(message.Text("少女祈祷中......")) data, err := web.RequestDataWith(web.NewDefaultClient(), coserURL, "GET", "", ua) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } text := gjson.Get(helper.BytesToString(data), "data.Title").String() @@ -50,7 +50,7 @@ func init() { if id := ctx.SendGroupForwardMessage( ctx.Event.GroupID, m).Get("message_id").Int(); id == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控或下载图片用时过长,请耐心等待")) + ctx.SendChain(message.Text("ERROR: 可能被风控或下载图片用时过长,请耐心等待")) } }) } diff --git a/plugin/cpstory/cpstory.go b/plugin/cpstory/cpstory.go index 32bcf747..03a3ede4 100644 --- a/plugin/cpstory/cpstory.go +++ b/plugin/cpstory/cpstory.go @@ -28,17 +28,17 @@ func init() { _, _ = engine.GetLazyData("cp.db", true) err := db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("cp_story", &cpstory{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } n, err := db.Count("cp_story") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Printf("[cpstory]读取%d条故事", n) diff --git a/plugin/curse/curse.go b/plugin/curse/curse.go index 378f5023..2a650cf6 100644 --- a/plugin/curse/curse.go +++ b/plugin/curse/curse.go @@ -31,22 +31,22 @@ func init() { db.DBPath = engine.DataFolder() + "curse.db" _, err := engine.GetLazyData("curse.db", true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("curse", &curse{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } c, err := db.Count("curse") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Infoln("[curse]加载", c, "条骂人语录") diff --git a/plugin/danbooru/main.go b/plugin/danbooru/main.go index b756bf50..8596c771 100644 --- a/plugin/danbooru/main.go +++ b/plugin/danbooru/main.go @@ -32,7 +32,7 @@ func init() { // 插件主体 for _, url := range ctx.State["image_url"].([]string) { t, err := danbooru.TagURL("", url) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } digest := md5.Sum(helper.StringToBytes(url)) diff --git a/plugin/diana/bing.go b/plugin/diana/bing.go index 38fb51ba..823550d7 100644 --- a/plugin/diana/bing.go +++ b/plugin/diana/bing.go @@ -26,7 +26,7 @@ func init() { getdb := fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { err := data.LoadText(engine.DataFolder() + "text.db") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } return true @@ -49,7 +49,7 @@ func init() { Handle(func(ctx *zero.Ctx) { err := data.AddText(ctx.State["regex_matched"].([]string)[1]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } else { ctx.SendChain(message.Text("记住啦!")) } diff --git a/plugin/diana/zhiwang.go b/plugin/diana/zhiwang.go index c6d98518..088cdd34 100644 --- a/plugin/diana/zhiwang.go +++ b/plugin/diana/zhiwang.go @@ -39,7 +39,7 @@ func init() { msg := ctx.GetMessage(message.NewMessageIDFromString(ctx.Event.Message[0].Data["id"])).Elements[0].Data["text"] result, err := zhiwangapi(msg) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if result.Get("code").Int() != 0 { diff --git a/plugin/drift_bottle/main.go b/plugin/drift_bottle/main.go index 2a298b32..c9c53530 100644 --- a/plugin/drift_bottle/main.go +++ b/plugin/drift_bottle/main.go @@ -55,7 +55,7 @@ func init() { msg, ).throw(sea, channel) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("你将它扔进大海,希望有人捞到吧~"))) @@ -78,7 +78,7 @@ func init() { logrus.Debugln("[driftbottle]", grp, channel) b, err := fetchBottle(sea, channel, grp) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } var wg sync.WaitGroup @@ -96,7 +96,7 @@ func init() { ) wg.Wait() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } }) @@ -109,7 +109,7 @@ func init() { } err := createChannel(sea, channel) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("成功~"))) @@ -125,7 +125,7 @@ func init() { c, err := sea.Count(channel) seamu.RUnlock() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("你缓缓走入大海,感受着海浪轻柔地拍打着你的小腿,膝盖……\n波浪卷着你的腰腹,你感觉有些把握不住平衡了……\n……\n你沉入海中,", c, " 个物体与你一同沉浮。\n不知何处涌来一股暗流,你失去了意识。"))) diff --git a/plugin/epidemic/epidemic.go b/plugin/epidemic/epidemic.go index 799dc08a..4adbfef6 100644 --- a/plugin/epidemic/epidemic.go +++ b/plugin/epidemic/epidemic.go @@ -64,7 +64,7 @@ func init() { } data, time, err := queryEpidemic(city) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if data == nil { diff --git a/plugin/font/main.go b/plugin/font/main.go index c6003d78..f9f20f6b 100644 --- a/plugin/font/main.go +++ b/plugin/font/main.go @@ -36,7 +36,7 @@ func init() { } b, err := text.RenderToBase64(txt, fnt, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Image("base64://" + binary.BytesToString(b))) diff --git a/plugin/fortune/fortune.go b/plugin/fortune/fortune.go index bcf8d6f2..f00703c2 100644 --- a/plugin/fortune/fortune.go +++ b/plugin/fortune/fortune.go @@ -92,17 +92,17 @@ func init() { func(ctx *zero.Ctx) bool { data, err := file.GetLazyData(omikujson, false) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = json.Unmarshal(data, &omikujis) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } _, err = file.GetLazyData(font, true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } return true @@ -128,14 +128,14 @@ func init() { zipfile := images + kind + ".zip" _, err := file.GetLazyData(zipfile, false) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } // 随机获取背景 background, index, err := randimage(zipfile, ctx) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } @@ -155,7 +155,7 @@ func init() { return err }, ctxext.Send(ctx), ctxext.GetMessage(ctx)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } }) diff --git a/plugin/funny/laugh.go b/plugin/funny/laugh.go index 4698a7dc..35e7bc06 100644 --- a/plugin/funny/laugh.go +++ b/plugin/funny/laugh.go @@ -35,22 +35,22 @@ func init() { db.DBPath = en.DataFolder() + "jokes.db" _, err := en.GetLazyData("jokes.db", true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("jokes", &joke{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } c, err := db.Count("jokes") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Infoln("[funny]加载", c, "个笑话") @@ -61,7 +61,7 @@ func init() { var j joke err := db.Pick("jokes", &j) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text(strings.ReplaceAll(j.Text, "%name", name))) diff --git a/plugin/genshin/ys.go b/plugin/genshin/ys.go index a9833749..aea430e7 100644 --- a/plugin/genshin/ys.go +++ b/plugin/genshin/ys.go @@ -63,7 +63,7 @@ func init() { err := c.SetData(gid, int64(store)) if err != nil { process.SleepAbout1sTo2s() - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } }) @@ -72,12 +72,12 @@ func init() { zipfile := engine.DataFolder() + "Genshin.zip" _, err := engine.GetLazyData("Genshin.zip", false) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = parsezip(zipfile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } return true @@ -96,7 +96,7 @@ func init() { store := (storage)(c.GetData(gid)) img, str, mode, err := randnums(10, store) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } b, cl := writer.ToBytes(img) diff --git a/plugin/gif/run.go b/plugin/gif/run.go index 75a15149..c463a450 100644 --- a/plugin/gif/run.go +++ b/plugin/gif/run.go @@ -150,13 +150,13 @@ func init() { // 插件主体 list := ctx.State["regex_matched"].([]string) err := c.prepareLogos(list[4]+list[5]+list[6], strconv.FormatInt(ctx.Event.UserID, 10)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } argslist := strings.Split(strings.TrimSuffix(strings.TrimPrefix(list[0], list[1]), list[2]), " ") picurl, err := cmdMap[list[1]](c, argslist...) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Image(picurl)) diff --git a/plugin/github/repo_searcher.go b/plugin/github/repo_searcher.go index 227fb737..c6131edc 100644 --- a/plugin/github/repo_searcher.go +++ b/plugin/github/repo_searcher.go @@ -35,12 +35,12 @@ func init() { // 插件主体 }.Encode() body, err := netGet(api.String(), header) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } // 解析请求 info := gjson.ParseBytes(body) if info.Get("total_count").Int() == 0 { - ctx.SendChain(message.Text("ERROR:没有找到这样的仓库")) + ctx.SendChain(message.Text("ERROR: 没有找到这样的仓库")) return } repo := info.Get("items.0") diff --git a/plugin/guessmusic/main.go b/plugin/guessmusic/main.go index 3d736b30..684cacb9 100644 --- a/plugin/guessmusic/main.go +++ b/plugin/guessmusic/main.go @@ -141,21 +141,21 @@ func init() { // 插件主体 } err = os.MkdirAll(cfg.MusicPath, 0755) if err != nil { - ctx.SendChain(message.Text("[生成文件夹错误]ERROR:", err)) + ctx.SendChain(message.Text("[生成文件夹错误]ERROR: ", err)) return } cfg.MusicPath = musicPath case "本地": choice, err := strconv.ParseBool(value) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } cfg.Local = choice case "Api": choice, err := strconv.ParseBool(value) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } cfg.API = choice @@ -164,7 +164,7 @@ func init() { // 插件主体 if err == nil { ctx.SendChain(message.Text("成功!")) } else { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } }) engine.OnFullMatch("登录网易云", zero.SuperUserPermission, func(ctx *zero.Ctx) bool { @@ -178,25 +178,25 @@ func init() { // 插件主体 keyURL := "https://music.cyrilstudio.top/login/qr/key" data, err := web.GetData(keyURL) if err != nil { - ctx.SendChain(message.Text("获取网易云key失败, ERROR:", err)) + ctx.SendChain(message.Text("获取网易云key失败, ERROR: ", err)) return } var keyInfo keyInfo err = json.Unmarshal(data, &keyInfo) if err != nil { - ctx.SendChain(message.Text("解析网易云key失败, ERROR:", err)) + ctx.SendChain(message.Text("解析网易云key失败, ERROR: ", err)) return } qrURL := "https://music.cyrilstudio.top/login/qr/create?key=" + keyInfo.Data.Unikey + "&qrimg=1" data, err = web.GetData(qrURL) if err != nil { - ctx.SendChain(message.Text("获取网易云二维码失败, ERROR:", err)) + ctx.SendChain(message.Text("获取网易云二维码失败, ERROR: ", err)) return } var qrInfo qrInfo err = json.Unmarshal(data, &qrInfo) if err != nil { - ctx.SendChain(message.Text("解析网易云二维码失败, ERROR:", err)) + ctx.SendChain(message.Text("解析网易云二维码失败, ERROR: ", err)) return } ctx.SendChain(message.Text("[请使用手机APP扫描二维码或者进入网页扫码登录]\n", qrInfo.Data.Qrurl), @@ -208,13 +208,13 @@ func init() { // 插件主体 referer := "https://music.cyrilstudio.top" data, err := web.RequestDataWith(web.NewDefaultClient(), apiURL, "GET", referer, ua) if err != nil { - ctx.SendChain(message.Text("无法获取登录状态, ERROR:", err)) + ctx.SendChain(message.Text("无法获取登录状态, ERROR: ", err)) return } var cookiesInfo cookyInfo err = json.Unmarshal(data, &cookiesInfo) if err != nil { - ctx.SendChain(message.Text("解析登录状态失败, ERROR:", err)) + ctx.SendChain(message.Text("解析登录状态失败, ERROR: ", err)) return } switch cookiesInfo.Code { @@ -224,7 +224,7 @@ func init() { // 插件主体 if err == nil { ctx.SendChain(message.Text("成功!")) } else { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } return case 801: @@ -266,7 +266,7 @@ func init() { // 插件主体 referer = "https://music.163.com/" data, err = web.RequestDataWith(web.NewDefaultClient(), apiURL, "GET", referer, ua) if err != nil { - ctx.SendChain(message.Text("无法获取歌单列表\n ERROR:", err)) + ctx.SendChain(message.Text("无法获取歌单列表\n ERROR: ", err)) return } var musiclist topMusicInfo @@ -289,7 +289,7 @@ func init() { // 插件主体 if err == nil { ctx.SendChain(message.Text("成功!")) } else { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } }) engine.OnRegex(`^删除歌单\s?(.*)$`, zero.SuperUserPermission).SetBlock(true).Limit(ctxext.LimitByGroup). @@ -319,7 +319,7 @@ func init() { // 插件主体 if err == nil { ctx.SendChain(message.Text("成功!")) } else { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } }) engine.OnFullMatch("获取歌单列表").SetBlock(true).Limit(ctxext.LimitByGroup). @@ -362,10 +362,10 @@ func init() { // 插件主体 } } } else { - ctx.SendChain(message.Text("[读取本地列表错误]ERROR:", err)) + ctx.SendChain(message.Text("[读取本地列表错误]ERROR: ", err)) } } else { - ctx.SendChain(message.Text("[生成文件夹错误]ERROR:", err)) + ctx.SendChain(message.Text("[生成文件夹错误]ERROR: ", err)) } } if msg == nil { @@ -626,12 +626,12 @@ func getcatlist(pathOfMusic string) error { } err := os.MkdirAll(pathOfMusic, 0755) if err != nil { - err = errors.Errorf("[生成文件夹错误]ERROR:%s", err) + err = errors.Errorf("[生成文件夹错误]ERROR: %s", err) return err } files, err := ioutil.ReadDir(pathOfMusic) if err != nil { - err = errors.Errorf("[读取本地列表错误]ERROR:%s", err) + err = errors.Errorf("[读取本地列表错误]ERROR: %s", err) return err } for i, name := range files { @@ -645,12 +645,12 @@ func musicLottery(mode, musicPath string) (musicName, pathOfMusic string, err er pathOfMusic = musicPath + mode + "/" err = os.MkdirAll(pathOfMusic, 0755) if err != nil { - err = errors.Errorf("[生成文件夹错误]ERROR:%s", err) + err = errors.Errorf("[生成文件夹错误]ERROR: %s", err) return } files, err := ioutil.ReadDir(pathOfMusic) if err != nil { - err = errors.Errorf("[读取本地列表错误]ERROR:%s", err) + err = errors.Errorf("[读取本地列表错误]ERROR: %s", err) return } listID, ok := catlist[mode] @@ -666,7 +666,7 @@ func musicLottery(mode, musicPath string) (musicName, pathOfMusic string, err er // 如果没有任何本地就下载歌曲 musicName, err = getListMusic(listIDstr, pathOfMusic) if err != nil { - err = errors.Errorf("[本地数据为0,歌曲下载错误]ERROR:%s", err) + err = errors.Errorf("[本地数据为0,歌曲下载错误]ERROR: %s", err) return } case rand.Intn(2) == 0 || !ok: @@ -693,7 +693,7 @@ func musicLottery(mode, musicPath string) (musicName, pathOfMusic string, err er if cfg.API && ok { musicName, err = getListMusic(listIDstr, pathOfMusic) if err != nil { - err = errors.Errorf("[获取API失败,未开启本地数据] ERROR:%s", err) + err = errors.Errorf("[获取API失败,未开启本地数据] ERROR: %s", err) return } return @@ -783,7 +783,7 @@ func getListMusic(listID, pathOfMusic string) (musicName string, err error) { func cutMusic(musicName, pathOfMusic, outputPath string) (err error) { err = os.MkdirAll(outputPath, 0755) if err != nil { - err = errors.Errorf("[生成歌曲目录错误]ERROR:%s", err) + err = errors.Errorf("[生成歌曲目录错误]ERROR: %s", err) return } var stderr bytes.Buffer @@ -795,7 +795,7 @@ func cutMusic(musicName, pathOfMusic, outputPath string) (err error) { cmd.Stderr = &stderr err = cmd.Run() if err != nil { - err = errors.Errorf("[生成歌曲错误]ERROR:%s", stderr.String()) + err = errors.Errorf("[生成歌曲错误]ERROR: %s", stderr.String()) return } return diff --git a/plugin/hs/run.go b/plugin/hs/run.go index 48b3079b..a5e13fa4 100644 --- a/plugin/hs/run.go +++ b/plugin/hs/run.go @@ -81,7 +81,7 @@ func init() { ctx.Event.GroupID, sk, ).Get("message_id").Int(); id == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } }) // 卡组 diff --git a/plugin/hyaku/main.go b/plugin/hyaku/main.go index 2016f518..6caf468e 100644 --- a/plugin/hyaku/main.go +++ b/plugin/hyaku/main.go @@ -107,11 +107,11 @@ func init() { engine.OnRegex(`^百人一首之\s?(\d+)$`).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { i, err := strconv.Atoi(ctx.State["regex_matched"].([]string)[1]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if i > 100 || i < 1 { - ctx.SendChain(message.Text("ERROR:超出范围")) + ctx.SendChain(message.Text("ERROR: 超出范围")) return } ctx.SendChain( diff --git a/plugin/image_finder/keyword.go b/plugin/image_finder/keyword.go index 4471ef5a..72144aa7 100644 --- a/plugin/image_finder/keyword.go +++ b/plugin/image_finder/keyword.go @@ -71,14 +71,14 @@ func init() { keyword := ctx.State["regex_matched"].([]string)[1] soutujson, err := soutuapi(keyword) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } rannum := rand.Intn(len(soutujson.Data.Illusts)) il := soutujson.Data.Illusts[rannum] illust, err := pixiv.Works(il.ID) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } u := illust.ImageUrls[0] @@ -101,7 +101,7 @@ func init() { ), ), ctxext.GetFirstMessageInForward(ctx)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } }) diff --git a/plugin/jandan/jandan.go b/plugin/jandan/jandan.go index 890ae2ff..33a2fb8c 100644 --- a/plugin/jandan/jandan.go +++ b/plugin/jandan/jandan.go @@ -34,17 +34,17 @@ func init() { _, _ = engine.GetLazyData("pics.db", false) err := db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("picture", &picture{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } n, err := db.Count("picture") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Printf("[jandan]读取%d张图片", n) @@ -55,7 +55,7 @@ func init() { Handle(func(ctx *zero.Ctx) { u, err := getRandomPicture() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Image(u)) @@ -67,13 +67,13 @@ func init() { webpageURL := api doc, err := htmlquery.LoadURL(webpageURL) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } re := regexp.MustCompile(`\d+`) pageTotal, err := strconv.Atoi(re.FindString(htmlquery.FindOne(doc, "//*[@id='comments']/div[2]/div/span[@class='current-comment-page']/text()").Data)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } LOOP: @@ -81,12 +81,12 @@ func init() { logrus.Debugln("[jandan]", fmt.Sprintf("处理第%d/%d页...", i, pageTotal)) doc, err = htmlquery.LoadURL(webpageURL) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } picList, err := htmlquery.QueryAll(doc, "//*[@class='view_img_link']") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if len(picList) != 0 { diff --git a/plugin/juejuezi/juejuezi.go b/plugin/juejuezi/juejuezi.go index ef5abcb5..f6376d7e 100644 --- a/plugin/juejuezi/juejuezi.go +++ b/plugin/juejuezi/juejuezi.go @@ -35,7 +35,7 @@ func init() { case 2: data, err := juejuezi(string(toDealStr[0]), string(toDealStr[1])) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text(gjson.Get(helper.BytesToString(data), "text").String())) @@ -43,7 +43,7 @@ func init() { params := ctx.GetWordSlices(string(toDealStr)).Get("slices").Array() data, err := juejuezi(params[0].String(), params[1].String()) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text(gjson.Get(helper.BytesToString(data), "text").String())) diff --git a/plugin/lolicon/lolicon.go b/plugin/lolicon/lolicon.go index daa61b3b..96ad27c3 100644 --- a/plugin/lolicon/lolicon.go +++ b/plugin/lolicon/lolicon.go @@ -43,7 +43,7 @@ func init() { if custapi != "" { data, err := web.GetData(custapi) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) continue } queue <- "base64://" + base64.StdEncoding.EncodeToString(data) @@ -51,12 +51,12 @@ func init() { } data, err := web.GetData(api) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) continue } json := gjson.ParseBytes(data) if e := json.Get("error").Str; e != "" { - ctx.SendChain(message.Text("ERROR:", e)) + ctx.SendChain(message.Text("ERROR: ", e)) continue } url := json.Get("data.0.urls.original").Str @@ -77,14 +77,14 @@ func init() { }() select { case <-time.After(time.Minute): - ctx.SendChain(message.Text("ERROR:等待填充,请稍后再试......")) + ctx.SendChain(message.Text("ERROR: 等待填充,请稍后再试......")) case img := <-queue: id := ctx.SendChain(message.Image(img)) if id.ID() == 0 { process.SleepAbout1sTo2s() id = ctx.SendChain(message.Image(img).Add("cache", "0")) if id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:图片发送失败,可能被风控了~")) + ctx.SendChain(message.Text("ERROR: 图片发送失败,可能被风控了~")) } } } @@ -93,7 +93,7 @@ func init() { Handle(func(ctx *zero.Ctx) { u := strings.TrimSpace(ctx.State["args"].(string)) if !strings.HasPrefix(u, "http") { - ctx.SendChain(message.Text("ERROR:url非法!")) + ctx.SendChain(message.Text("ERROR: url非法!")) return } custapi = u diff --git a/plugin/midicreate/midicreate.go b/plugin/midicreate/midicreate.go index 154e492b..7c521faf 100644 --- a/plugin/midicreate/midicreate.go +++ b/plugin/midicreate/midicreate.go @@ -56,7 +56,7 @@ func init() { ctx.UploadThisGroupFile(file.BOTPATH+"/"+midiFile, filepath.Base(midiFile), "") return } - ctx.SendChain(message.Text("ERROR:无法转换midi文件,", err)) + ctx.SendChain(message.Text("ERROR: 无法转换midi文件,", err)) return } ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + cmidiFile)) @@ -91,7 +91,7 @@ func init() { midiFile := cachePath + strconv.FormatInt(uid, 10) + time.Now().Format("20060102150405") + "_midicreate.mid" cmidiFile, err := str2music(ctx, answer, midiFile) if err != nil { - ctx.SendChain(message.Text("ERROR:听音练习结束, 无法转换midi文件, ", err)) + ctx.SendChain(message.Text("ERROR: 听音练习结束, 无法转换midi文件, ", err)) return } time.Sleep(time.Millisecond * 500) @@ -176,7 +176,7 @@ func init() { midiFile = cachePath + strconv.FormatInt(uid, 10) + time.Now().Format("20060102150405") + "_midicreate.mid" cmidiFile, err = str2music(ctx, answer, midiFile) if err != nil { - ctx.SendChain(message.Text("ERROR:听音练习结束, 无法转换midi文件, ", err)) + ctx.SendChain(message.Text("ERROR: 听音练习结束, 无法转换midi文件, ", err)) return } time.Sleep(time.Millisecond * 500) @@ -230,18 +230,18 @@ func init() { fileURL := ctx.GetThisGroupFileUrl(ctx.Event.File.BusID, ctx.Event.File.ID) data, err := web.GetData(fileURL) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } s, err := smf.ReadFrom(bytes.NewReader(data)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } for i := 0; i < int(s.NumTracks()); i++ { midStr := mid2txt(data, i) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } fileName := strings.ReplaceAll(cachePath+"/"+ctx.Event.File.Name, ".mid", fmt.Sprintf("-%d.txt", i)) @@ -256,14 +256,14 @@ func init() { fileURL := ctx.GetThisGroupFileUrl(ctx.Event.File.BusID, ctx.Event.File.ID) data, err := web.GetData(fileURL) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } uid := ctx.Event.UserID midiFile := cachePath + strconv.FormatInt(uid, 10) + time.Now().Format("20060102150405") + "_midicreate.mid" cmidiFile, err := str2music(ctx, binary.BytesToString(data), midiFile) if err != nil { - ctx.SendChain(message.Text("ERROR:无法转换midi文件,", err)) + ctx.SendChain(message.Text("ERROR: 无法转换midi文件,", err)) return } ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + cmidiFile)) @@ -273,7 +273,7 @@ func init() { param := ctx.State["args"].(string) timbre, err := strconv.Atoi(param) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } err = setTimbreMode(ctx, int64(timbre)) if err != nil { diff --git a/plugin/moyu_calendar/calendar.go b/plugin/moyu_calendar/calendar.go index cf1f58e0..33a9ae3c 100644 --- a/plugin/moyu_calendar/calendar.go +++ b/plugin/moyu_calendar/calendar.go @@ -21,7 +21,7 @@ func init() { Handle(func(ctx *zero.Ctx) { data, err := web.GetData("https://api.vvhan.com/api/moyu") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.ImageBytes(data)) diff --git a/plugin/music/selecter.go b/plugin/music/selecter.go index b0f7810a..dc1b1d8f 100644 --- a/plugin/music/selecter.go +++ b/plugin/music/selecter.go @@ -141,7 +141,7 @@ func cloud163(keyword string) (msg message.MessageSegment) { requestURL := "https://music.cyrilstudio.top/search?keywords=" + url.QueryEscape(keyword) data, err := web.GetData(requestURL) if err != nil { - msg = message.Text("ERROR:", err) + msg = message.Text("ERROR: ", err) return } msg = message.Music("163", gjson.ParseBytes(data).Get("result.songs.0.id").Int()) @@ -153,7 +153,7 @@ func qqmusic(keyword string) (msg message.MessageSegment) { requestURL := "https://c.y.qq.com/soso/fcgi-bin/client_search_cp?w=" + url.QueryEscape(keyword) data, err := web.RequestDataWith(web.NewDefaultClient(), requestURL, "GET", "", web.RandUA()) if err != nil { - msg = message.Text("ERROR:", err) + msg = message.Text("ERROR: ", err) return } info := gjson.ParseBytes(data[9 : len(data)-1]).Get("data.song.list.0") diff --git a/plugin/nativesetu/main.go b/plugin/nativesetu/main.go index ba0b8ac4..c7787e05 100644 --- a/plugin/nativesetu/main.go +++ b/plugin/nativesetu/main.go @@ -51,7 +51,7 @@ func init() { err := ns.db.Pick(imgtype, sc) ns.mu.RUnlock() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } else { p := "file:///" + setupath + "/" + sc.Path if ctx.Event.GroupID != 0 { @@ -71,7 +71,7 @@ func init() { if err == nil { ctx.SendChain(message.Text("成功!")) } else { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } }) engine.OnRegex(`^设置本地setu绝对路径(.*)$`, zero.SuperUserPermission).SetBlock(true). @@ -81,7 +81,7 @@ func init() { if err == nil { ctx.SendChain(message.Text("成功!")) } else { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } }) engine.OnFullMatch("刷新所有本地setu", zero.SuperUserPermission).SetBlock(true). @@ -90,7 +90,7 @@ func init() { if err == nil { ctx.SendChain(message.Text("成功!")) } else { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } }) engine.OnFullMatch("所有本地setu分类").SetBlock(true). diff --git a/plugin/nihongo/nihongo.go b/plugin/nihongo/nihongo.go index 51f14c8f..86acd447 100644 --- a/plugin/nihongo/nihongo.go +++ b/plugin/nihongo/nihongo.go @@ -25,22 +25,22 @@ func init() { db.DBPath = engine.DataFolder() + "nihongo.db" _, err := engine.GetLazyData("nihongo.db", true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("grammar", &grammar{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } n, err := db.Count("grammar") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } log.Infof("[nihongo]读取%d条语法", n) @@ -56,11 +56,11 @@ func init() { } data, err := text.RenderToBase64(g.string(), text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Image("base64://" + binary.BytesToString(data))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } }) } diff --git a/plugin/novel/qianbi.go b/plugin/novel/qianbi.go index da8f02d9..5369c8f2 100644 --- a/plugin/novel/qianbi.go +++ b/plugin/novel/qianbi.go @@ -46,18 +46,18 @@ func init() { ctx.SendChain(message.Text("少女祈祷中......")) err := login(username, password) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } searchKey := ctx.State["regex_matched"].([]string)[1] searchHTML, err := search(searchKey) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } doc, err := htmlquery.Parse(strings.NewReader(searchHTML)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } htmlTitle := htmlquery.InnerText(htmlquery.FindOne(doc, "/html/head/title")) @@ -65,7 +65,7 @@ func init() { case websiteTitle: list, err := htmlquery.QueryAll(doc, "//dl[@id='nr']") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if len(list) != 0 { @@ -89,11 +89,11 @@ func init() { } data, err := text.RenderToBase64(txt, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Image("base64://" + helper.BytesToString(data))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } } else { text := htmlquery.InnerText(htmlquery.FindOne(doc, "//div[@id='tipss']")) diff --git a/plugin/nsfw/main.go b/plugin/nsfw/main.go index 7250eba4..d2b439bd 100644 --- a/plugin/nsfw/main.go +++ b/plugin/nsfw/main.go @@ -26,7 +26,7 @@ func init() { ctx.SendChain(message.Text("少女祈祷中...")) p, err := nsfw.Classify(url[0]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text(judge(p)))) diff --git a/plugin/omikuji/sensou.go b/plugin/omikuji/sensou.go index bc8a7681..7c7610f4 100644 --- a/plugin/omikuji/sensou.go +++ b/plugin/omikuji/sensou.go @@ -41,22 +41,22 @@ func init() { // 插件主体 db.DBPath = engine.DataFolder() + "kuji.db" _, err := engine.GetLazyData("kuji.db", true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("kuji", &kuji{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } n, err := db.Count("kuji") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Infof("[kuji]读取%d条签文", n) @@ -71,11 +71,11 @@ func init() { // 插件主体 text.FontFile, 400, 20, ) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.At(ctx.Event.UserID), message.Image("base64://"+helper.BytesToString(kujiBytes))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } }) } diff --git a/plugin/qqwife/qqmapwife.go b/plugin/qqwife/qqmapwife.go index 55867877..b7500f3b 100644 --- a/plugin/qqwife/qqmapwife.go +++ b/plugin/qqwife/qqmapwife.go @@ -546,13 +546,13 @@ func init() { /***********下载字体,可以注销掉***********/ _, err = file.GetLazyData(text.BoldFontFile, true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } /***********设置字体颜色为黑色***********/ canvas.SetRGB(0, 0, 0) /***********设置字体大小,并获取字体高度用来定位***********/ if err = canvas.LoadFontFace(text.BoldFontFile, fontSize*2); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } sl, h := canvas.MeasureString("群老婆列表") @@ -561,7 +561,7 @@ func init() { canvas.DrawString("————————————————————", 0, 250-h) /***********设置字体大小,并获取字体高度用来定位***********/ if err = canvas.LoadFontFace(text.BoldFontFile, fontSize); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } _, h = canvas.MeasureString("焯") diff --git a/plugin/reborn/main.go b/plugin/reborn/main.go index 4ca98382..dffe5ce6 100644 --- a/plugin/reborn/main.go +++ b/plugin/reborn/main.go @@ -28,7 +28,7 @@ func init() { area := make(rate, 226) err := load(&area, jsonfile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } choices := make([]wr.Choice, len(area)) @@ -38,7 +38,7 @@ func init() { } areac, err = wr.NewChooser(choices...) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Printf("[Reborn]读取%d个国家/地区", len(area)) diff --git a/plugin/runcode/code_runner.go b/plugin/runcode/code_runner.go index ad51c419..ff3a908d 100644 --- a/plugin/runcode/code_runner.go +++ b/plugin/runcode/code_runner.go @@ -131,7 +131,7 @@ func init() { // 运行失败 ctx.SendChain( message.Text("> ", ctx.Event.Sender.NickName, "\n"), - message.Text("ERROR:", err), + message.Text("ERROR: ", err), ) } else { // 运行成功 diff --git a/plugin/saucenao/searcher.go b/plugin/saucenao/searcher.go index 2df32975..89eb1082 100644 --- a/plugin/saucenao/searcher.go +++ b/plugin/saucenao/searcher.go @@ -58,7 +58,7 @@ func init() { // 插件主体 // 获取P站插图信息 illust, err := pixiv.Works(id) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if illust.Pid > 0 { @@ -165,7 +165,7 @@ func init() { // 插件主体 } // ascii2d 搜索 if result, err := ascii2d.Ascii2d(pic); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) continue } else { msg := message.Message{ctxext.FakeSenderForwardNode(ctx, message.Text("ascii2d搜图结果"))} @@ -186,7 +186,7 @@ func init() { // 插件主体 ctx.Event.GroupID, msg, ).Get("message_id").Int(); id == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } } } @@ -199,12 +199,12 @@ func init() { // 插件主体 APIKey: ctx.State["regex_matched"].([]string)[1], }) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } err = os.WriteFile(apikeyfile, binary.StringToBytes(saucenaocli.APIKey), 0644) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("成功!")) diff --git a/plugin/scale/main.go b/plugin/scale/main.go index 54c4212a..b72692d9 100644 --- a/plugin/scale/main.go +++ b/plugin/scale/main.go @@ -54,7 +54,7 @@ func init() { p, err := nsfw.Classify(url[0]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if p.Drawings < 0.1 || p.Neutral > 0.8 { @@ -64,12 +64,12 @@ func init() { data := <-datachan if errsub != nil { - ctx.SendChain(message.Text("ERROR:", errsub)) + ctx.SendChain(message.Text("ERROR: ", errsub)) return } im, _, err := image.Decode(bytes.NewReader(data)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } px := im.Bounds().Size().X * im.Bounds().Size().Y @@ -85,7 +85,7 @@ func init() { defer binary.PutWriter(w) _, err = writer.WriteTo(im, w) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } data, err = scale.Post(bytes.NewReader(w.Bytes()), paras[0], paras[1], 2) @@ -93,14 +93,14 @@ func init() { data, err = scale.Get(url[0], paras[0], paras[1], 2) } if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } n := cachedir + strconv.Itoa(int(ctx.Event.UserID)) f, err := os.Create(n) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } _, _ = f.Write(data) diff --git a/plugin/score/sign_in.go b/plugin/score/sign_in.go index 6ab6944c..df9b3184 100644 --- a/plugin/score/sign_in.go +++ b/plugin/score/sign_in.go @@ -72,12 +72,12 @@ func init() { } err := initPic(picFile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } back, err := gg.LoadImage(picFile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if siUpdateTimeStr != today { @@ -98,11 +98,11 @@ func init() { hourWord := getHourWord(now) _, err = file.GetLazyData(text.BoldFontFile, true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if err = canvas.LoadFontFace(text.BoldFontFile, float64(back.Bounds().Size().X)*0.1); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } canvas.SetRGB(0, 0, 0) @@ -111,11 +111,11 @@ func init() { nickName := ctx.CardOrNickName(uid) _, err = file.GetLazyData(text.FontFile, true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if err = canvas.LoadFontFace(text.FontFile, float64(back.Bounds().Size().X)*0.04); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } add := 1 @@ -156,7 +156,7 @@ func init() { _, err = writer.WriteTo(canvas.Image(), f) _ = f.Close() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + drawedFile)) @@ -187,31 +187,31 @@ func init() { } st, err := sdb.GetScoreRankByTopN(10) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if len(st) == 0 { - ctx.SendChain(message.Text("ERROR:目前还没有人签到过")) + ctx.SendChain(message.Text("ERROR: 目前还没有人签到过")) return } _, err = file.GetLazyData(text.FontFile, true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } b, err := os.ReadFile(text.FontFile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } font, err := freetype.ParseFont(b) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } f, err := os.Create(drawedFile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } bars := make([]chart.Value, len(st)) @@ -234,7 +234,7 @@ func init() { _ = f.Close() if err != nil { _ = os.Remove(drawedFile) - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + drawedFile)) diff --git a/plugin/setutime/setu_geter.go b/plugin/setutime/setu_geter.go index ee73e139..05904cee 100644 --- a/plugin/setutime/setu_geter.go +++ b/plugin/setutime/setu_geter.go @@ -67,12 +67,12 @@ func init() { // 插件主体 _, _ = engine.GetLazyData("SetuTime.db", false) err := pool.db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } for _, imgtype := range pool.List() { if err := pool.db.Create(imgtype, &pixiv.Illust{}); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } } @@ -89,13 +89,13 @@ func init() { // 插件主体 ctx.SendChain(message.Text("INFO: 正在填充弹药......")) time.Sleep(time.Second * 10) if pool.size(imgtype) == 0 { - ctx.SendChain(message.Text("ERROR:等待填充,请稍后再试......")) + ctx.SendChain(message.Text("ERROR: 等待填充,请稍后再试......")) return } } // 从缓冲池里抽一张 if id := ctx.SendChain(*pool.pop(imgtype)); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } }) @@ -107,7 +107,7 @@ func init() { // 插件主体 ) err := pool.add(ctx, imgtype, id) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("成功向分类", imgtype, "添加图片", id)) @@ -121,7 +121,7 @@ func init() { // 插件主体 ) // 查询数据库 if err := pool.remove(imgtype, id); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text("删除成功")) @@ -162,7 +162,7 @@ func (p *imgpool) push(ctx *zero.Ctx, imgtype string, illust *pixiv.Illust) { if fileutil.IsNotExist(f) { // 下载图片 if err := illust.DownloadToCache(0); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } } @@ -200,7 +200,7 @@ func (p *imgpool) fill(ctx *zero.Ctx, imgtype string) { illust := &pixiv.Illust{} // 查询出一张图片 if err := p.db.Pick(imgtype, illust); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) continue } // 向缓冲池添加一张图片 diff --git a/plugin/shadiao/ergofabulous.go b/plugin/shadiao/ergofabulous.go index a3ede4a3..ace44ea5 100644 --- a/plugin/shadiao/ergofabulous.go +++ b/plugin/shadiao/ergofabulous.go @@ -11,12 +11,12 @@ func init() { engine.OnFullMatch("马丁路德骂我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { doc, err := htmlquery.LoadURL(ergofabulousURL) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } node, err := htmlquery.Query(doc, "//main[@role=\"main\"]/p[@class=\"larger\"]/text()") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(node.Data)) diff --git a/plugin/shadiao/shadiao.go b/plugin/shadiao/shadiao.go index c253761d..039923c4 100644 --- a/plugin/shadiao/shadiao.go +++ b/plugin/shadiao/shadiao.go @@ -39,7 +39,7 @@ func init() { requestURL := sdMap[ctx.State["matched"].(string)] data, err := web.RequestDataWith(web.NewDefaultClient(), requestURL, "GET", sdReferer, ua) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(gjson.GetBytes(data, "data.text").String())) diff --git a/plugin/shadiao/sweetnothings.go b/plugin/shadiao/sweetnothings.go index d45ac021..8dd4380e 100644 --- a/plugin/shadiao/sweetnothings.go +++ b/plugin/shadiao/sweetnothings.go @@ -14,7 +14,7 @@ func init() { engine.OnFullMatch("来碗绿茶").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { data, err := web.RequestDataWith(web.NewDefaultClient(), chayiURL, "GET", loveliveReferer, ua) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } text := gjson.Get(helper.BytesToString(data), "returnObj.content").String() @@ -24,7 +24,7 @@ func init() { engine.OnFullMatch("渣我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { data, err := web.RequestDataWith(web.NewDefaultClient(), ganhaiURL, "GET", loveliveReferer, ua) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } text := gjson.Get(helper.BytesToString(data), "returnObj.content").String() diff --git a/plugin/shadiao/yduanzi.go b/plugin/shadiao/yduanzi.go index 6d2240b1..2505baa8 100644 --- a/plugin/shadiao/yduanzi.go +++ b/plugin/shadiao/yduanzi.go @@ -16,7 +16,7 @@ func init() { engine.OnFullMatch("讲个段子").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { data, err := web.RequestDataWith(web.NewDefaultClient(), yduanziURL, "POST", yduanziReferer, ua) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } text := gjson.Get(helper.BytesToString(data), "duanzi").String() diff --git a/plugin/shindan/shindan.go b/plugin/shindan/shindan.go index f2cd479a..bfbdbd1a 100644 --- a/plugin/shindan/shindan.go +++ b/plugin/shindan/shindan.go @@ -35,7 +35,7 @@ func handletxt(ctx *zero.Ctx) { // 调用接口 txt, err := shindanmaker.Shindanmaker(ctx.State["id"].(int64), name) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text(txt)) @@ -47,7 +47,7 @@ func handlecq(ctx *zero.Ctx) { // 调用接口 txt, err := shindanmaker.Shindanmaker(ctx.State["id"].(int64), name) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.Send(txt) @@ -59,16 +59,16 @@ func handlepic(ctx *zero.Ctx) { // 调用接口 txt, err := shindanmaker.Shindanmaker(ctx.State["id"].(int64), name) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } data, err := text.RenderToBase64(txt, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Image("base64://" + helper.BytesToString(data))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } } diff --git a/plugin/tarot/tarot.go b/plugin/tarot/tarot.go index d1b65a04..ef7f8be4 100644 --- a/plugin/tarot/tarot.go +++ b/plugin/tarot/tarot.go @@ -59,12 +59,12 @@ func init() { getTarot := fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { data, err := engine.GetLazyData("tarots.json", true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = json.Unmarshal(data, &cardMap) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } for _, card := range cardMap { @@ -77,12 +77,12 @@ func init() { logrus.Infof("[tarot]读取%d张塔罗牌", len(cardMap)) formation, err := engine.GetLazyData("formation.json", true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = json.Unmarshal(formation, &formationMap) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } for k := range formationMap { @@ -104,19 +104,19 @@ func init() { var err error n, err = strconv.Atoi(match[:len(match)-3]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if n <= 0 { - ctx.SendChain(message.Text("ERROR:张数必须为正")) + ctx.SendChain(message.Text("ERROR: 张数必须为正")) return } if n > 1 && !zero.OnlyGroup(ctx) { - ctx.SendChain(message.Text("ERROR:抽取多张仅支持群聊")) + ctx.SendChain(message.Text("ERROR: 抽取多张仅支持群聊")) return } if n > 20 { - ctx.SendChain(message.Text("ERROR:抽取张数过多")) + ctx.SendChain(message.Text("ERROR: 抽取张数过多")) return } } @@ -132,7 +132,7 @@ func init() { if id := ctx.SendChain( message.Text(reasons[rand.Intn(len(reasons))], position[p], "』的『", name, "』\n"), message.Image(fmt.Sprintf("%s/%s/%s", bed, reverse[p], card.ImgURL))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } return } @@ -179,7 +179,7 @@ func init() { cardList, err := text.RenderToBase64(txt, text.FontFile, 420, 20) if err != nil { ctx.SendChain(message.Text("没有找到", match, "噢~")) - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } ctx.SendChain(message.Text("没有找到", match, "噢~"), message.Image("base64://"+binary.BytesToString(cardList))) } @@ -236,7 +236,7 @@ func init() { txt := build.String() formation, err := text.RenderToBase64(txt, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } msg[info.CardsNum] = ctxext.FakeSenderForwardNode(ctx, []message.MessageSegment{message.Image("base64://" + binary.BytesToString(formation))}...) diff --git a/plugin/tiangou/tiangou.go b/plugin/tiangou/tiangou.go index 805e3071..4d3387c4 100644 --- a/plugin/tiangou/tiangou.go +++ b/plugin/tiangou/tiangou.go @@ -34,22 +34,22 @@ func init() { db.DBPath = en.DataFolder() + "tiangou.db" _, err := en.GetLazyData("tiangou.db", true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Open(time.Hour * 24) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = db.Create("tiangou", &tiangou{}) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } c, err := db.Count("tiangou") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Infoln("[tiangou]加载", c, "条舔狗日记") @@ -59,7 +59,7 @@ func init() { var t tiangou err := db.Pick("tiangou", &t) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text(t.Text)) diff --git a/plugin/tracemoe/moe.go b/plugin/tracemoe/moe.go index 58813b75..8e1e374f 100644 --- a/plugin/tracemoe/moe.go +++ b/plugin/tracemoe/moe.go @@ -25,7 +25,7 @@ func init() { // 插件主体 ctx.SendChain(message.Text("少女祈祷中......")) for _, pic := range ctx.State["image_url"].([]string) { if result, err := moe.Search(pic, true, true); err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) } else if len(result.Result) > 0 { r := result.Result[0] hint := "我有把握是这个!" diff --git a/plugin/vtb_quotation/vtb_quotation.go b/plugin/vtb_quotation/vtb_quotation.go index fc9fd3ec..cec702b2 100644 --- a/plugin/vtb_quotation/vtb_quotation.go +++ b/plugin/vtb_quotation/vtb_quotation.go @@ -41,12 +41,12 @@ func init() { getdb := fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { err := os.MkdirAll(storePath, 0755) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } _, err = engine.GetLazyData("vtb.db", false) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } return true @@ -60,23 +60,23 @@ func init() { Repeat() // 不断监听复读 db, err := model.Open(dbfile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } defer db.Close() defer cancel() r, err := db.GetAllFirstCategoryMessage() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } firstStepImageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } // 步骤0,1,2,依次选择3个类别 step := 0 @@ -102,33 +102,33 @@ func init() { indexs[0] = num secondStepMessage, err := db.GetAllSecondCategoryMessageByFirstIndex(indexs[0]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if secondStepMessage == "" { ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输")) r, err := db.GetAllFirstCategoryMessage() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } firstStepImageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } errorCount++ } else { secondStepMessageBytes, err := text.RenderToBase64(secondStepMessage, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } step++ } @@ -137,33 +137,33 @@ func init() { indexs[1] = num thirdStepMessage, err := db.GetAllThirdCategoryMessageByFirstIndexAndSecondIndex(indexs[0], indexs[1]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if thirdStepMessage == "" { ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("你选择的序号没有内容,请重新选择,三次输入错误,指令可退出重输")) r, err := db.GetAllSecondCategoryMessageByFirstIndex(indexs[0]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } secondStepMessageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(secondStepMessageBytes))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } errorCount++ } else { thirdStepMessageBytes, err := text.RenderToBase64(thirdStepMessage, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(thirdStepMessageBytes))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } step++ } @@ -175,16 +175,16 @@ func init() { ctx.SendChain(message.Reply(c.Event.MessageID), message.Text("没有内容请重新选择,三次输入错误,指令可退出重输")) r, err := db.GetAllFirstCategoryMessage() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } firstStepImageBytes, err := text.RenderToBase64(r, text.FontFile, 400, 20) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } if id := ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("base64://"+helper.BytesToString(firstStepImageBytes))); id.ID() == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } errorCount++ step = 1 @@ -201,7 +201,7 @@ func init() { } err = initRecord(recordFile, recURL) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile)) @@ -220,7 +220,7 @@ func init() { Handle(func(ctx *zero.Ctx) { db, err := model.Open(dbfile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } defer db.Close() @@ -240,7 +240,7 @@ func init() { } err = initRecord(recordFile, recURL) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Record("file:///" + file.BOTPATH + "/" + recordFile)) @@ -253,19 +253,19 @@ func init() { if db != nil { vl, err := db.GetVtbList() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } for _, v := range vl { err = db.StoreVtb(v) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } } err = db.Close() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } } diff --git a/plugin/wangyiyun/main.go b/plugin/wangyiyun/main.go index af976ace..2ab94fe1 100644 --- a/plugin/wangyiyun/main.go +++ b/plugin/wangyiyun/main.go @@ -25,7 +25,7 @@ func init() { Handle(func(ctx *zero.Ctx) { data, err := web.RequestDataWith(web.NewDefaultClient(), wangyiyunURL, "GET", wangyiyunReferer, ua) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Text(helper.BytesToString(data))) diff --git a/plugin/word_count/word_count.go b/plugin/word_count/word_count.go index 4a115fa7..66da872f 100644 --- a/plugin/word_count/word_count.go +++ b/plugin/word_count/word_count.go @@ -44,12 +44,12 @@ func init() { engine.OnRegex(`^热词\s?(\d*)\s?(\d*)$`, zero.OnlyGroup, fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { _, err := engine.GetLazyData("stopwords.txt", false) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } data, err := os.ReadFile(engine.DataFolder() + "stopwords.txt") if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } stopwords = strings.Split(strings.ReplaceAll(binary.BytesToString(data), "\r", ""), "\n") @@ -60,17 +60,17 @@ func init() { Handle(func(ctx *zero.Ctx) { _, err := file.GetLazyData(text.FontFile, true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } b, err := os.ReadFile(text.FontFile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } font, err := freetype.ParseFont(b) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } @@ -141,7 +141,7 @@ func init() { } // 绘图 if len(wc) == 0 { - ctx.SendChain(message.Text("ERROR:历史消息为空或者无法获得历史消息")) + ctx.SendChain(message.Text("ERROR: 历史消息为空或者无法获得历史消息")) return } bars := make([]chart.Value, len(wc)) @@ -165,14 +165,14 @@ func init() { } f, err := os.Create(drawedFile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } err = graph.Render(chart.PNG, f) _ = f.Close() if err != nil { _ = os.Remove(drawedFile) - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Image("file:///" + file.BOTPATH + "/" + drawedFile)) diff --git a/plugin/wordle/wordle.go b/plugin/wordle/wordle.go index 5a206130..71b3cd40 100644 --- a/plugin/wordle/wordle.go +++ b/plugin/wordle/wordle.go @@ -120,7 +120,7 @@ func init() { } wg.Wait() if errcnt > 0 { - ctx.SendChain(message.Text("ERROR:下载字典时发生", errcnt, "个错误")) + ctx.SendChain(message.Text("ERROR: 下载字典时发生", errcnt, "个错误")) return false } return true @@ -131,7 +131,7 @@ func init() { target := words[class].cet4[rand.Intn(len(words[class].cet4))] tt, err := tl.Translate(target) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } game := newWordleGame(target) diff --git a/plugin/wtf/main.go b/plugin/wtf/main.go index 7c5c18c7..8dfc2ea8 100644 --- a/plugin/wtf/main.go +++ b/plugin/wtf/main.go @@ -30,7 +30,7 @@ func init() { // 调用接口 i, err := strconv.Atoi(ctx.State["regex_matched"].([]string)[1]) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } w := newWtf(i) @@ -53,7 +53,7 @@ func init() { text, err = w.predict(name) } if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } // TODO: 可注入 diff --git a/plugin/ymgal/ymgal.go b/plugin/ymgal/ymgal.go index be0e8029..f6811135 100644 --- a/plugin/ymgal/ymgal.go +++ b/plugin/ymgal/ymgal.go @@ -22,12 +22,12 @@ func init() { dbfile := engine.DataFolder() + "ymgal.db" _, err := engine.GetLazyData("ymgal.db", false) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } gdb, err = initialize(dbfile) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } return true @@ -62,7 +62,7 @@ func init() { ctx.Send("少女祈祷中......") err := updatePic() if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.Send("ymgal数据库已更新") @@ -84,6 +84,6 @@ func sendYmgal(y ymgal, ctx *zero.Ctx) { if id := ctx.SendGroupForwardMessage( ctx.Event.GroupID, m).Get("message_id").Int(); id == 0 { - ctx.SendChain(message.Text("ERROR:可能被风控了")) + ctx.SendChain(message.Text("ERROR: 可能被风控了")) } }