From 0c8dfb3f9c20fa18489ec214855f4de29ff18a42 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: Sat, 25 Mar 2023 20:23:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20ctx=20ERROR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/dailynews/dailynews.go | 2 +- plugin/drawlots/main.go | 16 ++++++++-------- plugin/wife/main.go | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/plugin/dailynews/dailynews.go b/plugin/dailynews/dailynews.go index 8b34fbb4fd..3ed761c298 100644 --- a/plugin/dailynews/dailynews.go +++ b/plugin/dailynews/dailynews.go @@ -29,7 +29,7 @@ func init() { } picURL := gjson.Get(binary.BytesToString(data), "imageUrl").String() 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/drawlots/main.go b/plugin/drawlots/main.go index 096dcff875..9d77e675cc 100644 --- a/plugin/drawlots/main.go +++ b/plugin/drawlots/main.go @@ -55,7 +55,7 @@ func init() { en.OnFullMatchGroup([]string{"抽签列表", "刷新抽签列表"}).SetBlock(true).Handle(func(ctx *zero.Ctx) { lotsList, err := getList() // 刷新列表 if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } messageText := &strings.Builder{} @@ -67,7 +67,7 @@ func init() { } textPic, err := text.RenderToBase64(messageText.String(), text.BoldFontFile, 400, 50) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Image("base64://" + helper.BytesToString(textPic))) @@ -82,7 +82,7 @@ func init() { if fileInfo.lotsType == "folder" { picPath, err := randFile(lotsType, 3) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Image("file:///"+picPath)) @@ -90,13 +90,13 @@ func init() { } lotsImg, err := randGif(lotsType + "." + fileInfo.lotsType) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } // 生成图片 data, err := imgfactory.ToBytes(lotsImg) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } ctx.SendChain(message.Reply(ctx.Event.MessageID), message.ImageBytes(data)) @@ -129,13 +129,13 @@ func init() { } im, err := gif.DecodeAll(bytes.NewReader(gifdata)) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } fileName := datapath + "/" + lotsName + ".gif" err = file.DownloadTo(picURL, fileName) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } lotsList[lotsName] = info{ @@ -158,7 +158,7 @@ func init() { } err := os.Remove(datapath + lotsName + "." + fileInfo.lotsType) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return } delete(lotsList, lotsName) diff --git a/plugin/wife/main.go b/plugin/wife/main.go index 21e19b5153..e86b41d536 100644 --- a/plugin/wife/main.go +++ b/plugin/wife/main.go @@ -25,12 +25,12 @@ func init() { func(ctx *zero.Ctx) bool { data, err := engine.GetLazyData("wife.json", true) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } err = json.Unmarshal(data, &cards) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) + ctx.SendChain(message.Text("ERROR: ", err)) return false } logrus.Infof("[wife]加载%d个老婆", len(cards))